@@ -308,16 +308,18 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
308
308
309
309
// Some functions are whitelisted until we figure out how to fix them.
310
310
// We walk up the stack a few frames to also cover their callees.
311
- const WHITELIST : & [ & str ] = & [
311
+ const WHITELIST : & [ ( & str , & str ) ] = & [
312
312
// 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" ) ,
315
317
] ;
316
318
for frame in ecx. stack ( ) . iter ( )
317
319
. rev ( ) . take ( 3 )
318
320
{
319
321
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 ) ) {
321
323
return false ;
322
324
}
323
325
}
@@ -453,7 +455,9 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
453
455
let ( size, _) = ecx. size_and_align_of_mplace ( place) ?
454
456
// for extern types, just cover what we can
455
457
. 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
+ {
457
461
// No tracking
458
462
Ok ( place. ptr )
459
463
} else {
0 commit comments