@@ -14,7 +14,7 @@ use rustc_middle::mir;
14
14
use rustc_middle:: ty:: {
15
15
self ,
16
16
layout:: { IntegerExt as _, LayoutOf , TyAndLayout } ,
17
- List , Ty , TyCtxt ,
17
+ Ty , TyCtxt ,
18
18
} ;
19
19
use rustc_span:: { def_id:: CrateNum , sym, Span , Symbol } ;
20
20
use rustc_target:: abi:: { Align , FieldIdx , FieldsShape , Integer , Size , Variants } ;
@@ -282,13 +282,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
282
282
Ok ( ptr. addr ( ) . bytes ( ) == 0 )
283
283
}
284
284
285
- /// Get the `Place` for a local
286
- fn local_place ( & self , local : mir:: Local ) -> InterpResult < ' tcx , PlaceTy < ' tcx , Provenance > > {
287
- let this = self . eval_context_ref ( ) ;
288
- let place = mir:: Place { local, projection : List :: empty ( ) } ;
289
- this. eval_place ( place)
290
- }
291
-
292
285
/// Generate some random bytes, and write them to `dest`.
293
286
fn gen_random ( & mut self , ptr : Pointer < Option < Provenance > > , len : u64 ) -> InterpResult < ' tcx > {
294
287
// Some programs pass in a null pointer and a length of 0
@@ -350,17 +343,21 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
350
343
// Initialize arguments.
351
344
let mut callee_args = this. frame ( ) . body . args_iter ( ) ;
352
345
for arg in args {
353
- let callee_arg = this. local_place (
354
- callee_args
355
- . next ( )
356
- . ok_or_else ( || err_ub_format ! ( "callee has fewer arguments than expected" ) ) ?,
357
- ) ?;
346
+ let local = callee_args
347
+ . next ( )
348
+ . ok_or_else ( || err_ub_format ! ( "callee has fewer arguments than expected" ) ) ?;
349
+ // Make the local live, and insert the initial value.
350
+ this. storage_live ( local) ?;
351
+ let callee_arg = this. local_to_place ( this. frame_idx ( ) , local) ?;
358
352
this. write_immediate ( * arg, & callee_arg) ?;
359
353
}
360
354
if callee_args. next ( ) . is_some ( ) {
361
355
throw_ub_format ! ( "callee has more arguments than expected" ) ;
362
356
}
363
357
358
+ // Initialize remaining locals.
359
+ this. storage_live_for_always_live_locals ( ) ?;
360
+
364
361
Ok ( ( ) )
365
362
}
366
363
0 commit comments