-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
silence new unexpected_cfgs lint (#404)
Rust 1.80 got a new lint to warn on unexpected cfg: https://blog.rust-lang.org/2024/07/25/Rust-1.80.0.html#checked-cfg-names-and-values To make cfg expected we either need to output "cargo::rustc-check-cfg=cfg(name)" from build.rs or add: [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(name)'] } to Cargo.toml Both `cargo::rustc-check-cfg` and `cargo:rustc-check-cfg` (two or one colons) are accepted. `::` is the 'correct' syntax as of Rust 1.77, but will error on some earlier versions. The `:` syntax is accepted (with warnings on some older versions) with both old and new versions, so these changes use `:`.
- Loading branch information
Showing
7 changed files
with
69 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
#[macro_export] | ||
macro_rules! rustc_cfg { | ||
($var:literal, $($cfg:tt)*) => { | ||
println!(concat!("cargo:rustc-cfg=", $var), $($cfg)*); | ||
($enable:expr, $var:literal, $($cfg:tt)*) => { | ||
println!(concat!("cargo:rustc-check-cfg=cfg(", $var, ")"), $($cfg)*); | ||
if $enable { | ||
println!(concat!("cargo:rustc-cfg=", $var), $($cfg)*); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters