From: Malte Schwarzkopf Date: Mon, 13 Feb 2017 00:56:41 +0000 (-0500) Subject: Fix CARGO_INCREMENTAL semantics to be intuitive X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~9^2~155^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=74cb863650b2bb8457531d29245e079350011a90;p=cargo.git Fix CARGO_INCREMENTAL semantics to be intuitive Previously, the mere presence of a CARGO_INCREMENTAL variable in the environment caused incremental compilation to happen. This has the very unintuitive effect that `CARGO_INCREMENTAL=0` and even `CARGO_INCREMENTAL=` mean incremental compilation is *on*. This change brings the semantics in line with how they are defined in the tests (cf. tests/build.rs:45), and in public-facing documentation (https://internals.rust-lang.org/t/incremental-compilation-beta/4721). --- diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index 4ecd6a7e5..31606eb52 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -78,7 +78,10 @@ impl<'a, 'cfg> Context<'a, 'cfg> { // Enable incremental builds if the user opts in. For now, // this is an environment variable until things stabilize a // bit more. - let incremental_enabled = env::var("CARGO_INCREMENTAL").is_ok(); + let incremental_enabled = match env::var("CARGO_INCREMENTAL") { + Ok(v) => v == "1", + Err(_) => false, + }; Ok(Context { ws: ws,