Merge pull request #2737 from dtolnay/checkcfg
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Resolve unexpected_cfgs warning
authored by David Tolnay · committed by GitHub · parents 20306f4, 220ca0c · Browse files · 7 files·+33 added−1 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+33 added−1 removed
- tests:+0 added−1 removed
- other:+33 added−0 removed
Provenance
- Commit
029ab46- Tree
6378964- Author
David Tolnay <dtolnay@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
20306f4- Parent 2
220ca0c
7 files changed+33 added−1 removed
modified:serde/build.rs+15 added
11 unmodified lines12 Some(minor) => minor,13 None => return,14 };15 16+ if minor >= 77 {17+ println!("cargo:rustc-check-cfg=cfg(doc_cfg)");18+ println!("cargo:rustc-check-cfg=cfg(no_core_cstr)");19+ println!("cargo:rustc-check-cfg=cfg(no_core_num_saturating)");20+ println!("cargo:rustc-check-cfg=cfg(no_core_try_from)");21+ println!("cargo:rustc-check-cfg=cfg(no_float_copysign)");22+ println!("cargo:rustc-check-cfg=cfg(no_num_nonzero_signed)");23+ println!("cargo:rustc-check-cfg=cfg(no_relaxed_trait_bounds)");24+ println!("cargo:rustc-check-cfg=cfg(no_serde_derive)");25+ println!("cargo:rustc-check-cfg=cfg(no_std_atomic)");26+ println!("cargo:rustc-check-cfg=cfg(no_std_atomic64)");27+ println!("cargo:rustc-check-cfg=cfg(no_systemtime_checked_add)");28+ println!("cargo:rustc-check-cfg=cfg(no_target_has_atomic)");29+ }30+31 let target = env::var("TARGET").unwrap();32 let emscripten = target == "asmjs-unknown-emscripten" || target == "wasm32-unknown-emscripten";33 34 // TryFrom, Atomic types, non-zero signed integers, and SystemTime::checked_add83 unmodified linesmodified:serde_derive/src/lib.rs+1 added
12 unmodified lines13 //!14 //! [https://serde.rs/derive.html]: https://serde.rs/derive.html15 16 #![doc(html_root_url = "https://docs.rs/serde_derive/1.0.200")]17+#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))]18 // Ignored clippy lints19 #![allow(20 // clippy false positive: https://github.com/rust-lang/rust-clippy/issues/705421 clippy::branches_sharing_code,81 unmodified linesadded:serde_derive/build.rs+7 added
1+fn main() {2+ // Warning: build.rs is not published to crates.io.3+4+ println!("cargo:rustc-cfg=check_cfg");5+ println!("cargo:rustc-check-cfg=cfg(check_cfg)");6+ println!("cargo:rustc-check-cfg=cfg(exhaustive)");7+}modified:serde_derive/Cargo.toml+1 added
4 unmodified lines567891011121322 unmodified lines4 unmodified linescategories = ["no-std", "no-std::no-alloc"]description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"documentation = "https://serde.rs/derive.html"edition = "2015"exclude = ["build.rs"]homepage = "https://serde.rs"keywords = ["serde", "serialization", "no_std", "derive"]license = "MIT OR Apache-2.0"readme = "crates-io.md"22 unmodified linesmodified:serde_derive_internals/build.rs+8 added
1 use std::path::Path;2 3 fn main() {4+ // Warning: build.rs is not published to crates.io.5+6 println!("cargo:rerun-if-changed=build.rs");7 println!("cargo:rerun-if-changed=src/mod.rs");8 9+ println!("cargo:rustc-cfg=check_cfg");10+ println!("cargo:rustc-check-cfg=cfg(check_cfg)");11+ println!("cargo:rustc-check-cfg=cfg(exhaustive)");12+ println!("cargo:rustc-check-cfg=cfg(serde_build_from_git)");13+ println!("cargo:rustc-check-cfg=cfg(feature, values(\"deserialize_in_place\"))");14+15 // Sometimes on Windows the git checkout does not correctly wire up the16 // symlink from serde_derive_internals/src to serde_derive/src/internals.17 // When this happens we'll just build based on relative paths within the git18 // repo.5 unmodified linesmodified:serde_derive_internals/lib.rs+1 added
1 #![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.29.0")]2+#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))]3 // Ignored clippy lints4 #![allow(5 clippy::cognitive_complexity,6 // clippy bug: https://github.com/rust-lang/rust-clippy/issues/757544 unmodified linesmodified:test_suite/tests/test_de_error.rs-1 removed
1522 unmodified lines1523 "overflow deserializing SystemTime epoch offset",1524 );1525 }1526 1527-#[cfg(not(no_systemtime_checked_add))]1527 #[test]1528 fn test_systemtime_overflow() {1529 assert_de_tokens_error::<SystemTime>(1530 &[38 unmodified lines