@@ -348,35 +348,27 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
348
348
349
349
// Incomplete shims that we "stub out" just to get pre-main initialization code to work.
350
350
// 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 ( ) => {
354
352
this. check_abi ( abi, Abi :: System { unwind : false } ) ?;
355
353
let & [ ] = check_arg_count ( args) ?;
356
354
// Just fake a HANDLE
357
355
this. write_scalar ( Scalar :: from_machine_isize ( 1 , this) , dest) ?;
358
356
}
359
- "SetConsoleTextAttribute"
360
- if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) =>
361
- {
357
+ "SetConsoleTextAttribute" if this. in_std ( ) => {
362
358
this. check_abi ( abi, Abi :: System { unwind : false } ) ?;
363
359
#[ allow( non_snake_case) ]
364
360
let & [ ref _hConsoleOutput, ref _wAttribute] = check_arg_count ( args) ?;
365
361
// Pretend these does not exist / nothing happened, by returning zero.
366
362
this. write_null ( dest) ?;
367
363
}
368
- "AddVectoredExceptionHandler"
369
- if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) =>
370
- {
364
+ "AddVectoredExceptionHandler" if this. in_std ( ) => {
371
365
this. check_abi ( abi, Abi :: System { unwind : false } ) ?;
372
366
#[ allow( non_snake_case) ]
373
367
let & [ ref _First, ref _Handler] = check_arg_count ( args) ?;
374
368
// Any non zero value works for the stdlib. This is just used for stack overflows anyway.
375
369
this. write_scalar ( Scalar :: from_machine_usize ( 1 , this) , dest) ?;
376
370
}
377
- "SetThreadStackGuarantee"
378
- if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) =>
379
- {
371
+ "SetThreadStackGuarantee" if this. in_std ( ) => {
380
372
this. check_abi ( abi, Abi :: System { unwind : false } ) ?;
381
373
#[ allow( non_snake_case) ]
382
374
let & [ _StackSizeInBytes] = check_arg_count ( args) ?;
@@ -387,7 +379,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
387
379
| "EnterCriticalSection"
388
380
| "LeaveCriticalSection"
389
381
| "DeleteCriticalSection"
390
- if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) =>
382
+ if this. in_std ( ) =>
391
383
{
392
384
this. check_abi ( abi, Abi :: System { unwind : false } ) ?;
393
385
#[ allow( non_snake_case) ]
@@ -401,9 +393,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
401
393
// (Windows locks are reentrant, and we have only 1 thread,
402
394
// so not doing any futher checks here is at least not incorrect.)
403
395
}
404
- "TryEnterCriticalSection"
405
- if this. frame ( ) . instance . to_string ( ) . starts_with ( "std::sys::windows::" ) =>
406
- {
396
+ "TryEnterCriticalSection" if this. in_std ( ) => {
407
397
this. check_abi ( abi, Abi :: System { unwind : false } ) ?;
408
398
#[ allow( non_snake_case) ]
409
399
let & [ ref _lpCriticalSection] = check_arg_count ( args) ?;
0 commit comments