File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -741,6 +741,20 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
741
741
)
742
742
}
743
743
744
+ /// Helper function used inside the shims of foreign functions to assert that the target OS
745
+ /// is one of `target_oses`. It panics showing a message with the `name` of the foreign function
746
+ /// if this is not the case.
747
+ fn assert_target_os_is_one_of ( & self , target_oses : & [ & str ] , name : & str ) {
748
+ assert ! (
749
+ target_oses. contains( & self . eval_context_ref( ) . tcx. sess. target. os. as_ref( ) ) ,
750
+ "`{name}` is only available on the {} target OS's" ,
751
+ target_oses. iter( ) . enumerate( ) . map( |( i, t) | match i {
752
+ 0 => format!( "`{t}`" ) ,
753
+ _ => format!( ", `{t}`" ) ,
754
+ } ) . collect:: <String >( )
755
+ )
756
+ }
757
+
744
758
/// Helper function used inside the shims of foreign functions to assert that the target OS
745
759
/// is part of the UNIX family. It panics showing a message with the `name` of the foreign function
746
760
/// if this is not the case.
Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
284
284
285
285
fn linux_gettid ( & mut self ) -> InterpResult < ' tcx , Scalar > {
286
286
let this = self . eval_context_ref ( ) ;
287
- this. assert_target_os ( "linux" , "gettid" ) ;
287
+ this. assert_target_os_is_one_of ( & [ "linux" , "android" ] , "gettid" ) ;
288
288
289
289
let index = this. machine . threads . active_thread ( ) . to_u32 ( ) ;
290
290
You can’t perform that action at this time.
0 commit comments