@@ -308,16 +308,18 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
308308
309309 // Some functions are whitelisted until we figure out how to fix them.
310310 // We walk up the stack a few frames to also cover their callees.
311- const WHITELIST : & [ & str ] = & [
311+ const WHITELIST : & [ ( & str , & str ) ] = & [
312312 // Uses mem::uninitialized
313- "std::ptr::read" ,
314- "std::sys::windows::mutex::Mutex::" ,
313+ ( "std::ptr::read" , "" ) ,
314+ ( "std::sys::windows::mutex::Mutex::" , "" ) ,
315+ // Should directly take a raw reference
316+ ( "<std::cell::UnsafeCell<T>>" , "::get" ) ,
315317 ] ;
316318 for frame in ecx. stack ( ) . iter ( )
317319 . rev ( ) . take ( 3 )
318320 {
319321 let name = frame. instance . to_string ( ) ;
320- if WHITELIST . iter ( ) . any ( |white | name. starts_with ( white ) ) {
322+ if WHITELIST . iter ( ) . any ( |( prefix , suffix ) | name. starts_with ( prefix ) && name . ends_with ( suffix ) ) {
321323 return false ;
322324 }
323325 }
@@ -453,7 +455,9 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
453455 let ( size, _) = ecx. size_and_align_of_mplace ( place) ?
454456 // for extern types, just cover what we can
455457 . unwrap_or_else ( || place. layout . size_and_align ( ) ) ;
456- if !ecx. machine . validate || size == Size :: ZERO {
458+ if !ecx. tcx . sess . opts . debugging_opts . mir_emit_retag ||
459+ !Self :: enforce_validity ( ecx) || size == Size :: ZERO
460+ {
457461 // No tracking
458462 Ok ( place. ptr )
459463 } else {
0 commit comments