@@ -463,11 +463,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
463
463
' tcx : ' a ,
464
464
' mir : ' a ,
465
465
{
466
- #[ cfg( target_os = " unix" ) ]
466
+ #[ cfg( unix) ]
467
467
fn bytes_to_os_str < ' tcx , ' a > ( bytes : & ' a [ u8 ] ) -> InterpResult < ' tcx , & ' a OsStr > {
468
- Ok ( std:: os:: unix:: ffi:: OsStringExt :: from_bytes ( bytes) )
468
+ Ok ( std:: os:: unix:: ffi:: OsStrExt :: from_bytes ( bytes) )
469
469
}
470
- #[ cfg( not( target_os = " unix" ) ) ]
470
+ #[ cfg( not( unix) ) ]
471
471
fn bytes_to_os_str < ' tcx , ' a > ( bytes : & ' a [ u8 ] ) -> InterpResult < ' tcx , & ' a OsStr > {
472
472
let s = std:: str:: from_utf8 ( bytes)
473
473
. map_err ( |_| err_unsup_format ! ( "{:?} is not a valid utf-8 string" , bytes) ) ?;
@@ -490,11 +490,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
490
490
scalar : Scalar < Tag > ,
491
491
size : u64 ,
492
492
) -> InterpResult < ' tcx , ( bool , u64 ) > {
493
- #[ cfg( target_os = " unix" ) ]
493
+ #[ cfg( unix) ]
494
494
fn os_str_to_bytes < ' tcx , ' a > ( os_str : & ' a OsStr ) -> InterpResult < ' tcx , & ' a [ u8 ] > {
495
- std:: os:: unix:: ffi:: OsStringExt :: into_bytes ( os_str)
495
+ Ok ( std:: os:: unix:: ffi:: OsStrExt :: as_bytes ( os_str) )
496
496
}
497
- #[ cfg( not( target_os = " unix" ) ) ]
497
+ #[ cfg( not( unix) ) ]
498
498
fn os_str_to_bytes < ' tcx , ' a > ( os_str : & ' a OsStr ) -> InterpResult < ' tcx , & ' a [ u8 ] > {
499
499
// On non-unix platforms the best we can do to transform bytes from/to OS strings is to do the
500
500
// intermediate transformation into strings. Which invalidates non-utf8 paths that are actually
0 commit comments