Cargo: Compiler warning on 1.16 with CARGO_INCREMENTAL

Created on 16 Mar 2017  路  12Comments  路  Source: rust-lang/cargo

Steps:

  • create a new project
  • CARGO_INCREMENTAL=1 cargo build with rust 1.16
warning: the option `Z` is unstable and should only be used on the nightly compiler, but it is currently accepted for backwards compatibility; this will soon change, see issue #31847 for more details

Seems to be because of -Zincremental=<path>.

Most helpful comment

Yeah, this is quite disturbing when you have some projects using nightly, and some that are stable/beta. I have CARGO_INCREMENTAL=1 in my .bashrc, and now see a large number of these warnings appear whenever I try to build one of my stable crates. Presumable they'll just refuse to build entirely now that -Z is dropped completely? Shouldn't cargo simply not pass -Zincremental if it's not supported?

All 12 comments

CARGO_INCREMENTAL is currently a nightly-only feature, so this is expected.

Oops, sorry

I think this is a bug, because I have expected CARGO_INCREMENTAL should be a no-op (or probably a warning if you care) in the "stable" Cargo. Well, I know, there is no "stable" version of Cargo, there is only a version of Cargo shipped with stable rustc, but this can be very confusing when you are working with both stable and nightly versions.

cc @nikomatsakis @michaelwoerister

Does Cargo know if it's using a nightly version of Rust?

Currently, no. It knows the version of rustc (as a string) but it doesn't attempt to parse the string

Yeah, this is quite disturbing when you have some projects using nightly, and some that are stable/beta. I have CARGO_INCREMENTAL=1 in my .bashrc, and now see a large number of these warnings appear whenever I try to build one of my stable crates. Presumable they'll just refuse to build entirely now that -Z is dropped completely? Shouldn't cargo simply not pass -Zincremental if it's not supported?

@jonhoo the intention here was that CARGO_INCREMENTAL=1 was experimental, e.g. a one-off basis rather than a global config. Cargo doesn't have a huge amount of knowledge of stable/beta/nightly right now. It seems reasonable to me though to patch cargo if possible!

Hmm, I don't know of anyone who explicitly types out CARGO_INCREMENTAL=1 cargo +nightly .... The people I've seen use it all have it set in their environment, but only expect it to apply to nightly builds. I have very limited knowledge of the cargo codebase, so don't quite know where I'd start to make changes to have it know about nightly flags..

I do! I don't like it though...

In any case, for anyone curious to change this (and that could be you @jonhoo!) some helpful pointers might be:

@alexcrichton sure, I'll take a look. Do you think it'd be better to only allow -Z on rustc versions that match nightly, or to instead ignore on things that match stable/beta?

PR filed in #4000.

Was this page helpful?
0 / 5 - 0 ratings