Skip to content

Commit

Permalink
Use RUSTC_WRAPPER if no other wrapper is provided (#918)
Browse files Browse the repository at this point in the history
* Use RUSTC_WRAPPER if no other wrapper is provided

Previously, the `rustc_wrapper_fallback` was only called if the tool
 was **not** a full path.
With this patch, the `RUSTC_WRAPPER` is always used, even if the tool
provided is an exact path.
Providing a wrapper manually is still possible and overrides the
`RUSTC_WRAPPER`.

If the path to the tool includes spaces it is otherwise impossible to
provide a compiler cache like sccache through the CXX or CC environment
variables, as the arguments will be split up incorrectly.

See also: corrosion-rs/corrosion#474

* Add #[allow(dead_code)] to ArchSpec::Catalyst

This should suppress new warnings generated by the nightly toolchain.
  • Loading branch information
LeonMatthesKDAB authored Jan 26, 2024
1 parent 8cf5455 commit 4d36cfa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2380,6 +2380,7 @@ impl Build {
enum ArchSpec {
Device(&'static str),
Simulator(&'static str),
#[allow(dead_code)]
Catalyst(&'static str),
}

Expand Down Expand Up @@ -2761,7 +2762,11 @@ impl Build {
// interpretation at all, just pass it on through. This'll hopefully get
// us to support spaces-in-paths.
if Path::new(&*tool).exists() {
return Some((PathBuf::from(&*tool), None, Vec::new()));
return Some((
PathBuf::from(&*tool),
Self::rustc_wrapper_fallback(),
Vec::new(),
));
}

// Ok now we want to handle a couple of scenarios. We'll assume from
Expand Down

0 comments on commit 4d36cfa

Please sign in to comment.