-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusing diagnostics for unstable features when building Rust with stable rustc #110067
Comments
Huh, usually Rust gets around this by setting |
It's set, but the command that's actually failing (it took some effort to figure out which executable was actually failing) is:
And what's installed for me in |
Forwards compatibility in diagnostics seems extremely hard. I think a much simpler and more helpful fix is to check the output of |
Note that the problem here is that you were trying to use 1.68 to build 1.70; it's unrelated to stable vs beta, the problem is that it was two versions behind instead of only one. |
Mentoring instructions: in Note that this should also disallow e.g. building 1.68 with 1.69; we use deny-warnings in most cases and have no guarantees that unstable features will be the same between releases. Only building 1.68 with 1.67 or 1.68 should be allowed. |
btw @catamorphism I've noticed you running into a few different bootstrap bugs the past few days — reading through https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html may or may not make it easier to diagnose these issues without having to spend ages interpreting the diagnostics. I'm also happy to chat about "how should this work" sorts of things on Zulip. |
Yes, I've read that.
Thanks! |
The error message could be improved though. Maybe one could make the |
@est31 I don't think rust-version is a good way to solve this, no - that won't give a warning or error if you use a future version to compile an older version. Also it won't be able to catch local-rebuild issues where the nightly version of the bootstrap compiler is too old. See my suggestion in #110067 (comment). |
Hmm, I'm afraid I might have said something unclear. I'm not asking for forward compatibility in diagnostics. The |
@catamorphism hmm, in that case something strange is going on because playground gives a much more reasonable error than the one you saw: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=72c1630fcbccba1d2df75abbe61a54bf
|
@catamorphism what commit of rustc were you trying to build when you got this error? I'm going to see if I can replicate it locally. |
I was trying to build 9452402 . |
Ah ok, it was related to the context of the If you look at the same gist with beta, the error message is much better:
So I think this particular diagnostic issue has already been fixed. I still want to keep this issue open to track checking the version of the bootstrap compiler, though. |
I'm trying to build Rust on a Tier 3 platform (
riscv64-alpine-linux-musl
; actually it'sriscv64-unknown-musl
that's listed in Tier 3, but I don't think that affects the problem). Since there are no snapshots for this platform, I installed rustc from the distro's package manager (apk) and created aconfig.toml
file to force using the pre-installed rustc rather than downloading snapshots:And the output of
rustc --version -v
:I ran
./x.py build
; when it got as far as building the core library, I got a series of errors that were very hard to make sense of until I realized that it's because core library code depends on unstable features and I was using a stable rustc to compile it:There were many more errors, but I think they all relate to unstable features.
It took me ages to figure out that (for example) the first error is due to the
const_closures
feature being disabled in stable.I understand that the stable compiler won't allow using unstable features even with
-Zunstable-options
, but is it possible for the parser to recognize this code even so and reject it with something like "featureconst_closures
is not enabled" instead of the much more generic "expected identifier" error?The text was updated successfully, but these errors were encountered: