@@ -15,44 +15,3 @@ pub mod os_str;
1515pub mod panic;
1616pub mod time;
1717pub mod tls;
18-
19- // End module management, begin local code
20-
21- use log:: trace;
22-
23- use rustc_middle:: { mir, ty} ;
24- use rustc_target:: spec:: abi:: Abi ;
25-
26- use crate :: * ;
27-
28- impl < ' mir , ' tcx : ' mir > EvalContextExt < ' mir , ' tcx > for crate :: MiriInterpCx < ' mir , ' tcx > { }
29- pub trait EvalContextExt < ' mir , ' tcx : ' mir > : crate :: MiriInterpCxExt < ' mir , ' tcx > {
30- fn find_mir_or_eval_fn (
31- & mut self ,
32- instance : ty:: Instance < ' tcx > ,
33- abi : Abi ,
34- args : & [ FnArg < ' tcx , Provenance > ] ,
35- dest : & PlaceTy < ' tcx , Provenance > ,
36- ret : Option < mir:: BasicBlock > ,
37- unwind : mir:: UnwindAction ,
38- ) -> InterpResult < ' tcx , Option < ( & ' mir mir:: Body < ' tcx > , ty:: Instance < ' tcx > ) > > {
39- let this = self . eval_context_mut ( ) ;
40- trace ! ( "eval_fn_call: {:#?}, {:?}" , instance, dest) ;
41-
42- // For foreign items, try to see if we can emulate them.
43- if this. tcx . is_foreign_item ( instance. def_id ( ) ) {
44- // An external function call that does not have a MIR body. We either find MIR elsewhere
45- // or emulate its effect.
46- // This will be Ok(None) if we're emulating the intrinsic entirely within Miri (no need
47- // to run extra MIR), and Ok(Some(body)) if we found MIR to run for the
48- // foreign function
49- // Any needed call to `goto_block` will be performed by `emulate_foreign_item`.
50- let args = this. copy_fn_args ( args) ?; // FIXME: Should `InPlace` arguments be reset to uninit?
51- let link_name = this. item_link_name ( instance. def_id ( ) ) ;
52- return this. emulate_foreign_item ( link_name, abi, & args, dest, ret, unwind) ;
53- }
54-
55- // Otherwise, load the MIR.
56- Ok ( Some ( ( this. load_mir ( instance. def , None ) ?, instance) ) )
57- }
58- }
0 commit comments