Skip to content

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

Closed

Description

@smoelius

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: https://github.com/mmastrac/rust-ctor/blob/fc9cd685f881b6a4055fddc9da3a28779bad6e10/ctor/src/lib.rs#L180-L181

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

Activity

  1. mmastrac commented on Nov 20, 2024

    @mmastrac
    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.

  2. added a commit that references this issue on Nov 20, 2024
  3. mmastrac commented on Nov 20, 2024

    @mmastrac
    Owner

    Fixed and released as 0.2.9.

  4. smoelius commented on Nov 20, 2024

    @smoelius
    Author

    Thanks for the prompt fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions