@@ -15,7 +15,9 @@ pub mod tls;
15
15
16
16
use log:: trace;
17
17
18
+ use rustc_middle:: ty:: layout:: HasParamEnv ;
18
19
use rustc_middle:: { mir, ty} ;
20
+ use rustc_target:: spec:: abi:: Abi ;
19
21
20
22
use crate :: * ;
21
23
use helpers:: check_arg_count;
@@ -25,6 +27,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
25
27
fn find_mir_or_eval_fn (
26
28
& mut self ,
27
29
instance : ty:: Instance < ' tcx > ,
30
+ abi : Abi ,
28
31
args : & [ OpTy < ' tcx , Tag > ] ,
29
32
ret : Option < ( PlaceTy < ' tcx , Tag > , mir:: BasicBlock ) > ,
30
33
unwind : Option < mir:: BasicBlock > ,
@@ -40,6 +43,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
40
43
}
41
44
}
42
45
46
+ if abi != Abi :: C {
47
+ throw_ub_format ! ( "calling a function with ABI {:?} using ABI {:?}" , Abi :: C , abi)
48
+ }
49
+
43
50
// Try to see if we can do something about foreign items.
44
51
if this. tcx . is_foreign_item ( instance. def_id ( ) ) {
45
52
// An external function call that does not have a MIR body. We either find MIR elsewhere
@@ -72,8 +79,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
72
79
return Ok ( false ) ;
73
80
}
74
81
75
- let req_align = this
76
- . force_bits ( this. read_scalar ( align_op) ?. check_init ( ) ?, this. pointer_size ( ) ) ?;
82
+ let req_align =
83
+ this . force_bits ( this. read_scalar ( align_op) ?. check_init ( ) ?, this. pointer_size ( ) ) ?;
77
84
78
85
// Stop if the alignment is not a power of two.
79
86
if !req_align. is_power_of_two ( ) {
0 commit comments