Skip to content

Commit

Permalink
fix not passing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yaahc committed Mar 30, 2019
1 parent 116c053 commit d2ab686
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
10 changes: 5 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,11 @@ 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 = 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 = dbg!(rustc.path.as_os_str().to_owned());
// wrapper.env("RUSTC", prog);
// rustc.push_wrapper(wrapper);
}

let host_config = TargetConfig::new(config, &rustc.host)?;
Expand Down
15 changes: 14 additions & 1 deletion src/cargo/core/compiler/compilation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,20 @@ pub struct Compilation<'cfg> {

impl<'cfg> Compilation<'cfg> {
pub fn new<'a>(bcx: &BuildContext<'a, 'cfg>) -> CargoResult<Compilation<'cfg>> {
let mut rustc = bcx.rustc.process();
// 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()
};

if bcx.config.extra_verbose() {
rustc.display_env_vars();
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/util/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl Config {
.join(".rustc_info.json")
.into_path_unlocked()
});
let wrapper = self.maybe_get_tool("rustc-wrapper")?;
let wrapper = self.maybe_get_tool("rustc_wrapper")?;
Rustc::new(
self.get_tool("rustc")?,
wrapper,
Expand Down

0 comments on commit d2ab686

Please sign in to comment.