Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
actually fix it so cargo fix kinda works with new wrapper stuff
  • Loading branch information
yaahc committed Mar 30, 2019
commit bccc0ee4e361f5ef34357097f7c21decd4c983bf
13 changes: 8 additions & 5 deletions src/cargo/core/compiler/build_context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,14 @@ impl<'a, 'cfg> BuildContext<'a, 'cfg> {
}
})?;
rustc.push_wrapper(RustcWrapper::new(tool));
// } else if build_config.cargo_as_rustc_wrapper {
// let mut wrapper = RustcWrapper::new(env::current_exe()?);
// let prog = dbg!(rustc.path.as_os_str().to_owned());
// wrapper.env("RUSTC", prog);
// rustc.push_wrapper(wrapper);
} else if build_config.cargo_as_rustc_wrapper {
let mut wrapper = RustcWrapper::new(env::current_exe()?);
let prog = rustc.path.as_os_str().to_owned();
wrapper.env("RUSTC", prog);
for (k, v) in build_config.extra_rustc_env.iter() {
wrapper.env(k, v);
}
rustc.push_wrapper(wrapper);
}

let host_config = TargetConfig::new(config, &rustc.host)?;
Expand Down
18 changes: 1 addition & 17 deletions src/cargo/core/compiler/compilation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,11 @@ pub struct Compilation<'cfg> {

impl<'cfg> Compilation<'cfg> {
pub fn new<'a>(bcx: &BuildContext<'a, 'cfg>) -> CargoResult<Compilation<'cfg>> {
// If we're using cargo as a rustc wrapper then we're in a situation
// like `cargo fix`. For now just disregard the `RUSTC_WRAPPER` env var
// (which is typically set to `sccache` for now). Eventually we'll
// probably want to implement `RUSTC_WRAPPER` for `cargo fix`, but we'll
// leave that open as a bug for now.
let mut rustc = if bcx.build_config.cargo_as_rustc_wrapper {
let mut rustc = bcx.rustc.process_no_wrapper();
let prog = rustc.get_program().to_owned();
rustc.env("RUSTC", prog);
rustc.program(env::current_exe()?);
rustc
} else {
bcx.rustc.process()
};
let mut rustc = bcx.rustc.process();

if bcx.config.extra_verbose() {
rustc.display_env_vars();
}
for (k, v) in bcx.build_config.extra_rustc_env.iter() {
rustc.env(k, v);
}
for arg in bcx.build_config.extra_rustc_args.iter() {
rustc.arg(arg);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/ops/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ impl Default for PrepareFor {
impl FixArgs {
fn get() -> FixArgs {
let mut ret = FixArgs::default();
for arg in env::args_os().skip(1) {
for arg in env::args_os().skip(2) {
let path = PathBuf::from(arg);
if path.extension().and_then(|s| s.to_str()) == Some("rs") && path.exists() {
ret.file = Some(path);
Expand Down