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

Unexpected cfgs beginning with nightly-2024-11-20 #309

Closed
smoelius opened this issue Nov 20, 2024 · 3 comments
Closed

Unexpected cfgs beginning with nightly-2024-11-20 #309

smoelius opened this issue Nov 20, 2024 · 3 comments

Comments

@smoelius
Copy link

Beginning with nightly-2024-11-20 (today), compiling a simple program like this:

#[ctor::ctor]
fn init() {}

produces a warning like this:

warning: unexpected `cfg` condition value: `used_linker`
 --> src/lib.rs:1:1
  |
1 | #[ctor::ctor]
  | ^^^^^^^^^^^^^
  |
  = note: no expected values for `feature`
  = help: consider adding `used_linker` as a feature in `Cargo.toml`
  = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
  = note: `#[warn(unexpected_cfgs)]` on by default
  = note: this warning originates in the attribute macro `ctor::ctor` (in Nightly builds, run with -Z macro-backtrace for more info)

This appears to be the relevant rustc change: rust-lang/rust#132577

My best guess is that these lines are the cause:

rust-ctor/ctor/src/lib.rs

Lines 180 to 181 in fc9cd68

#[cfg_attr(not(feature = "used_linker"), used)]
#[cfg_attr(feature = "used_linker", used(linker))]

Adding used_linker as a feature to the project makes the warning go away, but I suspect this is not the intent.

@mmastrac
Copy link
Owner

Ack. This was certainly an oversight in the original implementation of this feature.

I'll ponder a fix for this. Thanks for the great report.

mmastrac added a commit that referenced this issue Nov 20, 2024
Reported in #309 -- feature logic was wrong.
@mmastrac
Copy link
Owner

Fixed and released as 0.2.9.

@smoelius
Copy link
Author

Thanks for the prompt fix!

andersk added a commit to andersk/rspack that referenced this issue Dec 15, 2024
Fixes “warning: unexpected `cfg` condition value: `used_linker`” with
newer Rust.

mmastrac/rust-ctor#309

Signed-off-by: Anders Kaseorg <[email protected]>
h-a-n-a pushed a commit to web-infra-dev/rspack that referenced this issue Dec 16, 2024
* chore(deps): Switch anymap to anymap3

anymap seems unmaintained and emits a future incompatibility warning
with newer Rust.

chris-morgan/anymap#53

Signed-off-by: Anders Kaseorg <[email protected]>

* chore(deps): Upgrade ctor 0.2.3 to 0.2.9

Fixes “warning: unexpected `cfg` condition value: `used_linker`” with
newer Rust.

mmastrac/rust-ctor#309

Signed-off-by: Anders Kaseorg <[email protected]>

* chore(deps): Replace unmaintained derivative with derive_more

derivative triggers unfixable Clippy lints with new Rust.

rust-lang/rust-clippy#13811

Signed-off-by: Anders Kaseorg <[email protected]>

* chore: Fix clippy::empty_line_after_doc_comments

Signed-off-by: Anders Kaseorg <[email protected]>

* chore: Fix clippy::extra_unused_lifetimes

Signed-off-by: Anders Kaseorg <[email protected]>

* chore: Fix clippy::manual_c_str_literals

Signed-off-by: Anders Kaseorg <[email protected]>

* chore: Fix clippy::needless_lifetimes

Signed-off-by: Anders Kaseorg <[email protected]>

* chore: Fix clippy::needless_return

Signed-off-by: Anders Kaseorg <[email protected]>

* chore: Fix clippy::unnecessary_map_or

Signed-off-by: Anders Kaseorg <[email protected]>

* chore: upgrade Rust to 1.83.0 nightly

Upgrade Rust to nightly-2024-11-27, which was built on the same day as
1.83.0 stable.

Signed-off-by: Anders Kaseorg <[email protected]>

---------

Signed-off-by: Anders Kaseorg <[email protected]>
jsirois added a commit to jsirois/jump that referenced this issue Feb 20, 2025
Announcement: https://blog.rust-lang.org/2025/02/20/Rust-1.85.0.html

Also `cargo update -p ctor` to get past warning detailed here:
  mmastrac/rust-ctor#309
jsirois added a commit to a-scie/jump that referenced this issue Feb 20, 2025
Announcement: https://blog.rust-lang.org/2025/02/20/Rust-1.85.0.html

Also `cargo update -p ctor` to get past the warning detailed here:
  mmastrac/rust-ctor#309
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants