@@ -348,35 +348,27 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
348348
349349 // Incomplete shims that we "stub out" just to get pre-main initialization code to work.
350350 // These shims are enabled only when the caller is in the standard library.
351- "GetProcessHeap"
352- if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) =>
353- {
351+ "GetProcessHeap" if this. in_std ( ) => {
354352 this. check_abi ( abi, Abi :: System { unwind : false } ) ?;
355353 let & [ ] = check_arg_count ( args) ?;
356354 // Just fake a HANDLE
357355 this. write_scalar ( Scalar :: from_machine_isize ( 1 , this) , dest) ?;
358356 }
359- "SetConsoleTextAttribute"
360- if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) =>
361- {
357+ "SetConsoleTextAttribute" if this. in_std ( ) => {
362358 this. check_abi ( abi, Abi :: System { unwind : false } ) ?;
363359 #[ allow( non_snake_case) ]
364360 let & [ ref _hConsoleOutput, ref _wAttribute] = check_arg_count ( args) ?;
365361 // Pretend these does not exist / nothing happened, by returning zero.
366362 this. write_null ( dest) ?;
367363 }
368- "AddVectoredExceptionHandler"
369- if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) =>
370- {
364+ "AddVectoredExceptionHandler" if this. in_std ( ) => {
371365 this. check_abi ( abi, Abi :: System { unwind : false } ) ?;
372366 #[ allow( non_snake_case) ]
373367 let & [ ref _First, ref _Handler] = check_arg_count ( args) ?;
374368 // Any non zero value works for the stdlib. This is just used for stack overflows anyway.
375369 this. write_scalar ( Scalar :: from_machine_usize ( 1 , this) , dest) ?;
376370 }
377- "SetThreadStackGuarantee"
378- if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) =>
379- {
371+ "SetThreadStackGuarantee" if this. in_std ( ) => {
380372 this. check_abi ( abi, Abi :: System { unwind : false } ) ?;
381373 #[ allow( non_snake_case) ]
382374 let & [ _StackSizeInBytes] = check_arg_count ( args) ?;
@@ -387,7 +379,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
387379 | "EnterCriticalSection"
388380 | "LeaveCriticalSection"
389381 | "DeleteCriticalSection"
390- if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) =>
382+ if this. in_std ( ) =>
391383 {
392384 this. check_abi ( abi, Abi :: System { unwind : false } ) ?;
393385 #[ allow( non_snake_case) ]
@@ -401,9 +393,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
401393 // (Windows locks are reentrant, and we have only 1 thread,
402394 // so not doing any futher checks here is at least not incorrect.)
403395 }
404- "TryEnterCriticalSection"
405- if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) =>
406- {
396+ "TryEnterCriticalSection" if this. in_std ( ) => {
407397 this. check_abi ( abi, Abi :: System { unwind : false } ) ?;
408398 #[ allow( non_snake_case) ]
409399 let & [ ref _lpCriticalSection] = check_arg_count ( args) ?;
0 commit comments