Omit derive helpers in versions older than serde_derive msrv

This commit is contained in:
David Tolnay 2021-01-24 20:26:56 -08:00
parent 74ca06662e
commit b0cc213e57
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 8 additions and 0 deletions

View File

@ -71,6 +71,11 @@ fn main() {
println!("cargo:rustc-cfg=num_nonzero");
}
// Current minimum supported version of serde_derive crate is Rust 1.31.
if minor >= 31 {
println!("cargo:rustc-cfg=serde_derive");
}
// TryFrom, Atomic types, and non-zero signed integers stabilized in Rust 1.34:
// https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#tryfrom-and-tryinto
// https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#library-stabilizations

View File

@ -1,5 +1,8 @@
#[cfg(serde_derive)]
pub mod de;
#[cfg(serde_derive)]
pub mod ser;
pub mod size_hint;
// FIXME: #[cfg(doctest)] once https://github.com/rust-lang/rust/issues/67295 is fixed.