Skip to content

Commit d193758

Browse files
author
The Miri Cronjob Bot
committed
Merge from rustc
2 parents 8f8a296 + 6a604cc commit d193758

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

src/bin/miri.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ fn main() {
341341
// (`install_ice_hook` might change `RUST_BACKTRACE`.)
342342
let env_snapshot = env::vars_os().collect::<Vec<_>>();
343343

344+
let args = rustc_driver::args::raw_args(&early_dcx).unwrap_or_else(|_| std::process::exit(rustc_driver::EXIT_FAILURE));
345+
344346
// If the environment asks us to actually be rustc, then do that.
345347
if let Some(crate_kind) = env::var_os("MIRI_BE_RUSTC") {
346348
// Earliest rustc setup.
@@ -358,7 +360,7 @@ fn main() {
358360

359361
// We cannot use `rustc_driver::main` as we need to adjust the CLI arguments.
360362
run_compiler(
361-
env::args().collect(),
363+
args,
362364
target_crate,
363365
&mut MiriBeRustCompilerCalls { target_crate },
364366
using_internal_features,
@@ -381,7 +383,7 @@ fn main() {
381383

382384
// If user has explicitly enabled/disabled isolation
383385
let mut isolation_enabled: Option<bool> = None;
384-
for arg in env::args() {
386+
for arg in args {
385387
if rustc_args.is_empty() {
386388
// Very first arg: binary name.
387389
rustc_args.push(arg);

src/machine.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::fmt;
88
use std::path::Path;
99
use std::process;
1010

11-
use either::Either;
1211
use rand::rngs::StdRng;
1312
use rand::Rng;
1413
use rand::SeedableRng;
@@ -957,7 +956,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
957956
// to run extra MIR), and Ok(Some(body)) if we found MIR to run for the
958957
// foreign function
959958
// Any needed call to `goto_block` will be performed by `emulate_foreign_item`.
960-
let args = ecx.copy_fn_args(args)?; // FIXME: Should `InPlace` arguments be reset to uninit?
959+
let args = ecx.copy_fn_args(args); // FIXME: Should `InPlace` arguments be reset to uninit?
961960
let link_name = ecx.item_link_name(instance.def_id());
962961
return ecx.emulate_foreign_item(link_name, abi, &args, dest, ret, unwind);
963962
}
@@ -976,7 +975,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
976975
ret: Option<mir::BasicBlock>,
977976
unwind: mir::UnwindAction,
978977
) -> InterpResult<'tcx> {
979-
let args = ecx.copy_fn_args(args)?; // FIXME: Should `InPlace` arguments be reset to uninit?
978+
let args = ecx.copy_fn_args(args); // FIXME: Should `InPlace` arguments be reset to uninit?
980979
ecx.emulate_dyn_sym(fn_val, abi, &args, dest, ret, unwind)
981980
}
982981

@@ -1329,18 +1328,12 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
13291328

13301329
fn protect_in_place_function_argument(
13311330
ecx: &mut InterpCx<'mir, 'tcx, Self>,
1332-
place: &PlaceTy<'tcx, Provenance>,
1331+
place: &MPlaceTy<'tcx, Provenance>,
13331332
) -> InterpResult<'tcx> {
13341333
// If we have a borrow tracker, we also have it set up protection so that all reads *and
13351334
// writes* during this call are insta-UB.
13361335
let protected_place = if ecx.machine.borrow_tracker.is_some() {
1337-
// Have to do `to_op` first because a `Place::Local` doesn't imply the local doesn't have an address.
1338-
if let Either::Left(place) = ecx.place_to_op(place)?.as_mplace_or_imm() {
1339-
ecx.protect_place(&place)?.into()
1340-
} else {
1341-
// Locals that don't have their address taken are as protected as they can ever be.
1342-
place.clone()
1343-
}
1336+
ecx.protect_place(&place)?.into()
13441337
} else {
13451338
// No borrow tracker.
13461339
place.clone()

0 commit comments

Comments
 (0)