@@ -1557,31 +1557,27 @@ define_print_and_forward_display! {
1557
1557
( ConstValue :: Scalar ( Scalar :: Bits { bits, ..} ) , ty:: Uint ( ui) ) =>
1558
1558
p!( write( "{}{}" , bits, ui) ) ,
1559
1559
( ConstValue :: Scalar ( Scalar :: Bits { bits, ..} ) , ty:: Int ( i) ) => {
1560
- let size = ty:: tls:: with( |tcx| {
1561
- let ty = tcx. lift_to_global( & self . ty) . unwrap( ) ;
1562
- tcx. layout_of( ty:: ParamEnv :: empty( ) . and( ty) )
1563
- . unwrap( )
1564
- . size
1565
- } ) ;
1560
+ let ty = cx. tcx( ) . lift_to_global( & self . ty) . unwrap( ) ;
1561
+ let size = cx. tcx( ) . layout_of( ty:: ParamEnv :: empty( ) . and( ty) )
1562
+ . unwrap( )
1563
+ . size;
1566
1564
p!( write( "{}{}" , sign_extend( bits, size) as i128 , i) )
1567
1565
} ,
1568
1566
( ConstValue :: Scalar ( Scalar :: Bits { bits, ..} ) , ty:: Char )
1569
1567
=> p!( write( "{}" , :: std:: char :: from_u32( bits as u32 ) . unwrap( ) ) ) ,
1570
- ( _, ty:: FnDef ( did, _) ) => p!( write( "{}" , ty :: tls :: with ( | tcx| tcx . def_path_str( * did) ) ) ) ,
1568
+ ( _, ty:: FnDef ( did, _) ) => p!( write( "{}" , cx . tcx( ) . def_path_str( * did) ) ) ,
1571
1569
( ConstValue :: Slice ( _, 0 ) , ty:: Ref ( _, & ty:: TyS { sty: ty:: Str , .. } , _) ) =>
1572
1570
p!( write( "\" \" " ) ) ,
1573
1571
(
1574
1572
ConstValue :: Slice ( Scalar :: Ptr ( ptr) , len) ,
1575
1573
ty:: Ref ( _, & ty:: TyS { sty: ty:: Str , .. } , _) ,
1576
1574
) => {
1577
- ty:: tls:: with( |tcx| {
1578
- let alloc = tcx. alloc_map. lock( ) . unwrap_memory( ptr. alloc_id) ;
1579
- assert_eq!( len as usize as u64 , len) ;
1580
- let slice =
1581
- & alloc. bytes[ ( ptr. offset. bytes( ) as usize ) ..] [ ..( len as usize ) ] ;
1582
- let s = :: std:: str :: from_utf8( slice) . expect( "non utf8 str from miri" ) ;
1583
- Ok ( p!( write( "{:?}" , s) ) )
1584
- } ) ?;
1575
+ let alloc = cx. tcx( ) . alloc_map. lock( ) . unwrap_memory( ptr. alloc_id) ;
1576
+ assert_eq!( len as usize as u64 , len) ;
1577
+ let slice =
1578
+ & alloc. bytes[ ( ptr. offset. bytes( ) as usize ) ..] [ ..( len as usize ) ] ;
1579
+ let s = :: std:: str :: from_utf8( slice) . expect( "non utf8 str from miri" ) ;
1580
+ p!( write( "{:?}" , s) )
1585
1581
} ,
1586
1582
_ => p!( write( "{:?} : " , self . val) , print( self . ty) ) ,
1587
1583
}
0 commit comments