Skip to content

Commit

Permalink
Use a dedicated cfg for PathBuf::into_boxed_path
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 27, 2019
1 parent 4e31c99 commit a00aee1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions serde/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ fn main() {
// https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.into_boxed_path
if minor >= 20 {
println!("cargo:rustc-cfg=de_boxed_c_str");
println!("cargo:rustc-cfg=de_boxed_path");
}

// From<Box<T>> for Rc<T> / Arc<T> stabilized in Rust 1.21:
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 @@ -1610,7 +1610,7 @@ impl<'de> Deserialize<'de> for PathBuf {
}
}

#[cfg(all(feature = "std", de_boxed_c_str))]
#[cfg(all(feature = "std", de_boxed_path))]
forwarded_impl!((), Box<Path>, PathBuf::into_boxed_path);

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

0 comments on commit a00aee1

Please sign in to comment.