Skip to content

Commit

Permalink
Workaround rust-lang#703 to prevent obscure failures due to sccache.
Browse files Browse the repository at this point in the history
  • Loading branch information
marmistrz committed Dec 8, 2018
1 parent bfa1371 commit caa8b55
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub mod server;
mod test;

const RUSTC_SHIM_ENV_VAR_NAME: &str = "RLS_RUSTC_SHIM";
const RUSTC_WRAPPER_ENV_VAR: &str = "RUSTC_WRAPPER";

type Span = rls_span::Span<rls_span::ZeroIndexed>;

Expand All @@ -73,6 +74,17 @@ pub fn main() {
fn main_inner() -> i32 {
env_logger::init();

// [workaround]
// Currently sccache breaks RLS with obscure error messages.
// Until it's actually fixed disable the wrapper completely
// in the current process tree.
//
// See https://github.com/rust-lang/rls/issues/703
// and https://github.com/mozilla/sccache/issues/303
if env::var(RUSTC_WRAPPER_ENV_VAR) != Ok("sccache".to_owned()) {
env::remove_var(RUSTC_WRAPPER_ENV_VAR);
}

if env::var(RUSTC_SHIM_ENV_VAR_NAME)
.map(|v| v != "0")
.unwrap_or(false)
Expand Down

0 comments on commit caa8b55

Please sign in to comment.