File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,8 +29,9 @@ fn main() {
2929 println ! ( "cargo:rustc-cfg=core_reverse" ) ;
3030 }
3131
32- // CString::into_boxed_c_str stabilized in Rust 1.20:
32+ // CString::into_boxed_c_str and PathBuf::into_boxed_path stabilized in Rust 1.20:
3333 // https://doc.rust-lang.org/std/ffi/struct.CString.html#method.into_boxed_c_str
34+ // https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.into_boxed_path
3435 if minor >= 20 {
3536 println ! ( "cargo:rustc-cfg=de_boxed_c_str" ) ;
3637 }
Original file line number Diff line number Diff line change @@ -1610,6 +1610,9 @@ impl<'de> Deserialize<'de> for PathBuf {
16101610 }
16111611}
16121612
1613+ #[ cfg( all( feature = "std" , de_boxed_c_str) ) ]
1614+ forwarded_impl ! ( ( ) , Box <Path >, PathBuf :: into_boxed_path) ;
1615+
16131616////////////////////////////////////////////////////////////////////////////////
16141617
16151618// If this were outside of the serde crate, it would just use:
Original file line number Diff line number Diff line change @@ -907,6 +907,20 @@ declare_tests! {
907907 Token :: ByteBuf ( b"/usr/local/lib" ) ,
908908 ] ,
909909 }
910+ test_boxed_path {
911+ PathBuf :: from( "/usr/local/lib" ) . into_boxed_path( ) => & [
912+ Token :: Str ( "/usr/local/lib" ) ,
913+ ] ,
914+ PathBuf :: from( "/usr/local/lib" ) . into_boxed_path( ) => & [
915+ Token :: String ( "/usr/local/lib" ) ,
916+ ] ,
917+ PathBuf :: from( "/usr/local/lib" ) . into_boxed_path( ) => & [
918+ Token :: Bytes ( b"/usr/local/lib" ) ,
919+ ] ,
920+ PathBuf :: from( "/usr/local/lib" ) . into_boxed_path( ) => & [
921+ Token :: ByteBuf ( b"/usr/local/lib" ) ,
922+ ] ,
923+ }
910924 test_cstring {
911925 CString :: new( "abc" ) . unwrap( ) => & [
912926 Token :: Bytes ( b"abc" ) ,
You can’t perform that action at this time.
0 commit comments