Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure with default_features = false #1242

Closed
jaskij opened this issue Apr 5, 2024 · 3 comments · Fixed by #1247
Closed

Build failure with default_features = false #1242

jaskij opened this issue Apr 5, 2024 · 3 comments · Fixed by #1247
Labels
defect Suspected defect such as a bug or regression

Comments

@jaskij
Copy link

jaskij commented Apr 5, 2024

Observed behavior

When depending on async-nats = "0.34.0, if I set default-features = false, it fails to build with the following error:

error[E0560]: struct `jetstream::stream::Config` has no field named `compression`
    --> /home/jaskij/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-nats-0.34.0/src/jetstream/context.rs:1048:17
     |
1048 |                 compression: if config.compression {
     |                 ^^^^^^^^^^^ `jetstream::stream::Config` does not have this field
     |
     = note: available fields are: `max_bytes`, `max_messages`, `max_messages_per_subject`, `discard_new_per_subject`, `retention` ... and 12 others

For more information about this error, try `rustc --explain E0560`.
error: could not compile `async-nats` (lib) due to 1 previous error

Expected behavior

The crate builds and works as intended.

Server and client version

from my Cargo.toml

async-nats = { version = "0.34.0", default-features = false }

Host environment

up-to-date Arch Linux running on x86-64, building with current Rust stable

$ cargo --version
cargo 1.77.1 (e52e36006 2024-03-26)

Steps to reproduce

Make a Rust crate depending on async-nats 0.34.0 with default-features = false. It fails to build.

@jaskij jaskij added the defect Suspected defect such as a bug or regression label Apr 5, 2024
@jaskij
Copy link
Author

jaskij commented Apr 5, 2024

Since your template doesn't have a field for comments: in your CI you should at least ensure every possible combination of feature flags builds, preferably test it to the extent possible. I have found cargo-hack extremely useful for this.

@Jarema
Copy link
Member

Jarema commented Apr 9, 2024

Thanks for the report!

We can definately add this to Ci and of course fix the compilation.

However, I do not recommend running this crate with disabled default features, as those are related to working with older server versions.

Every new API or client feature is not enabled by default (like Service API).

@jaskij
Copy link
Author

jaskij commented Apr 9, 2024

However, I do not recommend running this crate with disabled default features, as those are related to working with older server versions.

Having read the feature flag description (thanks for the quick update!), yeah, I will definitely enable server_2_10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants