Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Compiler warning on 1.16 with CARGO_INCREMENTAL #3835

Closed
Yamakaky opened this issue Mar 16, 2017 · 12 comments · Fixed by #4000
Closed

Compiler warning on 1.16 with CARGO_INCREMENTAL #3835

Yamakaky opened this issue Mar 16, 2017 · 12 comments · Fixed by #4000

Comments

@Yamakaky
Copy link

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>.

@alexcrichton
Copy link
Member

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

@Yamakaky
Copy link
Author

Oops, sorry

@lifthrasiir
Copy link
Contributor

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.

@alexcrichton
Copy link
Member

cc @nikomatsakis @michaelwoerister

@michaelwoerister
Copy link
Member

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

@alexcrichton
Copy link
Member

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

@jonhoo
Copy link
Contributor

jonhoo commented May 5, 2017

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?

@alexcrichton
Copy link
Member

@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!

@jonhoo
Copy link
Contributor

jonhoo commented May 5, 2017

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..

@alexcrichton
Copy link
Member

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:

@jonhoo
Copy link
Contributor

jonhoo commented May 6, 2017

@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?

@jonhoo
Copy link
Contributor

jonhoo commented May 6, 2017

PR filed in #4000.

bors added a commit that referenced this issue May 7, 2017
Only pass -Zincremental to nightly rustc.

`-Z` can only be used on nightly builds; other builds complain loudly. Since incremental builds only work on nightly anyway, we should silently ignore `CARGO_INCREMENTAL` on anything but nightly. This allows users to always have `CARGO_INCREMENTAL` set without getting unexpected errors on stable/beta builds.

Fixes #3835.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants