Skip to content

Commit

Permalink
Merge pull request #1284 from serde-rs/boxcstr
Browse files Browse the repository at this point in the history
Stabilize Deserialize for Box<CStr>
  • Loading branch information
dtolnay authored May 26, 2018
2 parents 350406e + 7ec3cac commit 8a59695
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions serde/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ fn main() {
Err(_) => return,
};

// 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 {
println!("cargo:rustc-cfg=de_boxed_c_str");
}

// 128-bit integers stabilized in Rust 1.26:
// https://blog.rust-lang.org/2018/05/10/Rust-1.26.html
if minor >= 26 {
Expand Down
2 changes: 1 addition & 1 deletion serde/src/de/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ macro_rules! forwarded_impl {
}
}

#[cfg(all(feature = "std", feature = "unstable"))]
#[cfg(all(feature = "std", de_boxed_c_str))]
forwarded_impl!((), Box<CStr>, CString::into_boxed_c_str);

////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 8a59695

Please sign in to comment.