Skip to content

Commit 47c82f0

Browse files
committed
remove unnecessary rustc env for cargo fix
1 parent bccc0ee commit 47c82f0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/cargo/core/compiler/build_context/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ impl<'a, 'cfg> BuildContext<'a, 'cfg> {
7171
rustc.push_wrapper(RustcWrapper::new(tool));
7272
} else if build_config.cargo_as_rustc_wrapper {
7373
let mut wrapper = RustcWrapper::new(env::current_exe()?);
74-
let prog = rustc.path.as_os_str().to_owned();
75-
wrapper.env("RUSTC", prog);
7674
for (k, v) in build_config.extra_rustc_env.iter() {
7775
wrapper.env(k, v);
7876
}

src/cargo/ops/fix.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ pub fn fix_maybe_exec_rustc() -> CargoResult<bool> {
207207

208208
let args = FixArgs::get();
209209
trace!("cargo-fix as rustc got file {:?}", args.file);
210-
let rustc = env::var_os("RUSTC").expect("failed to find RUSTC env var");
210+
let rustc = args.rustc.as_ref().expect("fix wrapper rustc was not set");
211211

212212
// Our goal is to fix only the crates that the end user is interested in.
213213
// That's very likely to only mean the crates in the workspace the user is
@@ -576,6 +576,7 @@ struct FixArgs {
576576
enabled_edition: Option<String>,
577577
other: Vec<OsString>,
578578
primary_package: bool,
579+
rustc: Option<PathBuf>,
579580
}
580581

581582
enum PrepareFor {
@@ -593,6 +594,7 @@ impl Default for PrepareFor {
593594
impl FixArgs {
594595
fn get() -> FixArgs {
595596
let mut ret = FixArgs::default();
597+
ret.rustc = env::args_os().nth(1).map(PathBuf::from);
596598
for arg in env::args_os().skip(2) {
597599
let path = PathBuf::from(arg);
598600
if path.extension().and_then(|s| s.to_str()) == Some("rs") && path.exists() {

0 commit comments

Comments
 (0)