-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Closed as not planned
Labels
C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.F-check-cfg--check-cfg--check-cfgS-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.Status: This issue has no reproduction and needs a reproduction to make progress.
Description
Yeah, I'm using Rust 1.81.0, within my
./.cargo/config.toml, I have:[build] # MUST put `rustflags` NOT `RUSTFLAGS` rustflags=["--cfg", "MAINNET"]Then I have a very simple
./src/main.rs:fn main() { #[cfg(MAINNET)] println!( "Hello, world! from `bins` and from `MAINNET`", ); #[cfg(TESTNET)] println!( "Hello, world! from `bins` and from `TESTNET`", ); }These are the warnings I get from
cargo check:warning: unexpected `cfg` condition name: `MAINNET` --> crates/bins/simulate_txn/src/main.rs:2:11 | 2 | #[cfg(MAINNET)] | ^^^^^^^ | = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(MAINNET)'] } = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(MAINNET)");` to the top of the `build.rs` = 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 warning: unexpected `cfg` condition name: `TESTNET` --> crates/bins/simulate_txn/src/main.rs:7:11 | 7 | #[cfg(TESTNET)] | ^^^^^^^ | = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(TESTNET)'] } = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(TESTNET)");` to the top of the `build.rs` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configurationI tried adding the suggested fixes to
./build.rs:fn main() { println!("cargo::rustc-check-cfg=cfg(TESTNET)"); println!("cargo::rustc-check-cfg=cfg(MAINNET)"); }It does not work at all.
Metadata
Metadata
Assignees
Labels
C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.F-check-cfg--check-cfg--check-cfgS-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.Status: This issue has no reproduction and needs a reproduction to make progress.