[GH-ISSUE #561] The 'notify' feature requires the 'streaming' feature, otherwise it won't compile #322

Closed
opened 2026-03-02 23:46:33 +03:00 by kerem · 1 comment
Owner

Originally created by @DJ-pH3luy on GitHub (Sep 6, 2024).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/561

Describe the bug
See title: Building the app with the 'notify' feature set also requires the 'streaming' feature to be set, otherwise it won't compile.

To Reproduce
Build the app with: cargo build --release --bin spotify_player --no-default-features --features notify

Expected behaviour
It should be possible to compile 'notify' on its own (or make it dependent on 'streaming').

The problem lies in the if statement in spotify_player/src/client/mod.rs:1464 : It gets enabled ONLY by the 'notify' feature flag but in ln1465 two fields are accessed which are only present when BOTH 'notify' and 'streaming' flags are set (see spotify_player/src/client/mod.rs:36 and spotify_player/src/config/mod.rs:109). Thus it won't compile.

As I'm not familiar with the project I'm not sure if it is fixed by simply changing client/mod.rs:ln1463 from #[cfg(feature = "notify")] to #[cfg(all(feature = "streaming", feature = "notify"))] so that these fields are only accessed when we are sure that they are present. But I suspect this would somewhat break the notify feature (if compiled on its own).

Log and backtrace
Compiler error:

error[E0609]: no field `notify_streaming_only` on type `AppConfig`
    --> spotify_player/src/client/mod.rs:1465:37
     |
1465 |             && (!configs.app_config.notify_streaming_only || self.stream_conn.lock().is_some())
     |                                     ^^^^^^^^^^^^^^^^^^^^^ unknown field
     |
     = note: available fields are: `theme`, `client_id`, `client_id_command`, `client_port`, `player_event_hook_command` ... and 20 others

error[E0609]: no field `stream_conn` on type `&client::Client`
    --> spotify_player/src/client/mod.rs:1465:67
     |
1465 |             && (!configs.app_config.notify_streaming_only || self.stream_conn.lock().is_some())
     |                                                                   ^^^^^^^^^^^ unknown field
     |
     = note: available fields are: `http`, `spotify`, `auth_config`
     = note: available field is: `session`

For more information about this error, try `rustc --explain E0609`.
error: could not compile `spotify_player` (bin "spotify_player") due to 2 previous errors

Screenshots

Environment

  • OS: Opensuse Tumbleweed
  • Application version: cargo 1.81.0, spotify-player (latest master)
  • Application features: any feature combination with 'notify' and without 'streaming'

Additional context
Maybe a good first issue? I'd like to fix it / open a PR by myself but I'm quite unfamiliar with this project (and with rust).

Originally created by @DJ-pH3luy on GitHub (Sep 6, 2024). Original GitHub issue: https://github.com/aome510/spotify-player/issues/561 **Describe the bug** See title: Building the app with the 'notify' feature set also requires the 'streaming' feature to be set, otherwise it won't compile. **To Reproduce** Build the app with: `cargo build --release --bin spotify_player --no-default-features --features notify` **Expected behaviour** It should be possible to compile 'notify' on its own (or make it dependent on 'streaming'). The problem lies in the if statement in spotify_player/src/client/mod.rs:1464 : It gets enabled ONLY by the 'notify' feature flag but in ln1465 two fields are accessed which are only present when BOTH 'notify' and 'streaming' flags are set (see spotify_player/src/client/mod.rs:36 and spotify_player/src/config/mod.rs:109). Thus it won't compile. As I'm not familiar with the project I'm not sure if it is fixed by simply changing client/mod.rs:ln1463 from #[cfg(feature = "notify")] to #[cfg(all(feature = "streaming", feature = "notify"))] so that these fields are only accessed when we are sure that they are present. But I suspect this would somewhat break the notify feature (if compiled on its own). **Log and backtrace** Compiler error: ``` error[E0609]: no field `notify_streaming_only` on type `AppConfig` --> spotify_player/src/client/mod.rs:1465:37 | 1465 | && (!configs.app_config.notify_streaming_only || self.stream_conn.lock().is_some()) | ^^^^^^^^^^^^^^^^^^^^^ unknown field | = note: available fields are: `theme`, `client_id`, `client_id_command`, `client_port`, `player_event_hook_command` ... and 20 others error[E0609]: no field `stream_conn` on type `&client::Client` --> spotify_player/src/client/mod.rs:1465:67 | 1465 | && (!configs.app_config.notify_streaming_only || self.stream_conn.lock().is_some()) | ^^^^^^^^^^^ unknown field | = note: available fields are: `http`, `spotify`, `auth_config` = note: available field is: `session` For more information about this error, try `rustc --explain E0609`. error: could not compile `spotify_player` (bin "spotify_player") due to 2 previous errors ``` **Screenshots** **Environment** - OS: Opensuse Tumbleweed - Application version: cargo 1.81.0, spotify-player (latest master) - Application features: any feature combination with 'notify' and without 'streaming' **Additional context** Maybe a good first issue? I'd like to fix it / open a PR by myself but I'm quite unfamiliar with this project (and with rust).
kerem 2026-03-02 23:46:33 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@DJ-pH3luy commented on GitHub (Sep 7, 2024):

just proposed a fix in #562

<!-- gh-comment-id:2335724498 --> @DJ-pH3luy commented on GitHub (Sep 7, 2024): just proposed a fix in #562
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-player#322
No description provided.