Reverse impls available for Rust >=1.19

This commit is contained in:
Artem Vorotnikov 2019-02-20 04:53:34 +03:00
parent f3ffcfd61e
commit 71fe2a5534
No known key found for this signature in database
GPG Key ID: E0148C3F2FBB7A20
4 changed files with 9 additions and 0 deletions

View File

@ -23,6 +23,12 @@ fn main() {
println!("cargo:rustc-cfg=collections_bound");
}
// core::cmp::Reverse stabilized in Rust 1.19:
// https://doc.rust-lang.org/stable/core/cmp/struct.Reverse.html
if minor >= 19 {
println!("cargo:rustc-cfg=core_reverse");
}
// CString::into_boxed_c_str stabilized in Rust 1.20:
// https://doc.rust-lang.org/std/ffi/struct.CString.html#method.into_boxed_c_str
if minor >= 20 {

View File

@ -578,6 +578,7 @@ macro_rules! forwarded_impl {
#[cfg(all(feature = "std", de_boxed_c_str))]
forwarded_impl!((), Box<CStr>, CString::into_boxed_c_str);
#[cfg(core_reverse)]
forwarded_impl!((T), Reverse<T>, Reverse);
////////////////////////////////////////////////////////////////////////////////

View File

@ -139,6 +139,7 @@ mod lib {
pub use self::core::cell::{Cell, RefCell};
pub use self::core::clone::{self, Clone};
#[cfg(core_reverse)]
pub use self::core::cmp::Reverse;
pub use self::core::convert::{self, From, Into};
pub use self::core::default::{self, Default};

View File

@ -825,6 +825,7 @@ where
}
}
#[cfg(core_reverse)]
impl<T> Serialize for Reverse<T>
where
T: Serialize,