You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a way for the test suite to test the output of a stable rustc #123404
Right now ui tests only target the output of the currently built rustc. As far as I can tell, there's no -Z flag to tell rustc "act as if you were a stable release". This means that when we customize the diagnostic output based on release channel, we cannot test what stable users will actually see. An example of this is this (as of now unmerged) change that on stable refers to unsized locals and unsized fn arguments with the same note telling the user that's not allowed, while on nightly it tells the user which feature flag is gating that being allowed, without the note stating it's not allowed. That kind of behavior is replicated in multiple diagnostics involving nightly features already. It's the same "problem" we'd have with editions if we didn't already have a stable flag to specify them.
Another usecase would be to use something like
RUSTC_STABLE=1 rustc ice.rs to check if an ICE would happen on $todays nightly in several months after promotion to beta/stable has happened already. 🙂
I'd be concerned with people having set RUSTC_BOOTSTRAP=0 globally in their machines and suddenly having issues with nightly, but at the same time "setting that flag has no stability guarantees".
FWIW I went with RUSTC_BOOTSTRAP=-1 to mean "force-stable" in #132993 instead of RUSTC_BOOTSTRAP=0 which can seem like "not bootstrap" which is not quite the same I feel like, and probably confusing.
For future reference, while you can force a given rustc (well, later than #132993 of course) to pretend to be stable for all intents and purposes, there will still be an important caveat:
-> real stable rustc <- actually stable
|
-> beta rustc
|
-> nightly rustc
|
-> `master` rustc <- pretend to be stable
the master or nightly or beta rustc will almost certainly contain changes that are not present in the actual stable rustc (unavoidable), which is something important to keep in mind.
That being said, I think we can consider this feature request to be sufficiently satisfied via RUSTC_BOOTSTRAP=-1.
This didn't actually enable testing stable output in UI tests, because compiletest unconditionally passes certain -Z flags, and that breaks if you truly make rustc act like stable. We needed -2 all along (#163664), which acts as stable, but allows unstable compiler flags 😆
Activity
matthiaskrgr commentedon Apr 3, 2024
Another usecase would be to use something like
RUSTC_STABLE=1 rustc ice.rs to check if an ICE would happen on $todays nightly in several months after promotion to beta/stable has happened already. 🙂
Mark-Simulacrum commentedon Apr 3, 2024
RUSTC_BOOTSTRAP=0 feels like a reasonable mechanism/extension to me.
estebank commentedon Apr 4, 2024
I'd be concerned with people having set
RUSTC_BOOTSTRAP=0globally in their machines and suddenly having issues with nightly, but at the same time "setting that flag has no stability guarantees".jieyouxu commentedon Nov 13, 2024
FWIW I went with
RUSTC_BOOTSTRAP=-1to mean "force-stable" in #132993 instead ofRUSTC_BOOTSTRAP=0which can seem like "not bootstrap" which is not quite the same I feel like, and probably confusing.Implementation steps
RUSTC_BOOTSTRAP=-1RUSTC_BOOTSTRAP=-1#132993RUSTC_BOOTSTRAP=-1RUSTC_BOOTSTRAPfor misc testing rustc-dev-guide#2136UI tests can use something like
to
foolconvince the unstable compiler under test to think it's very stable. We can of course also add a//@ pretend-stable-rustcbut yeah.bjorn3 commentedon Nov 13, 2024
There is
-Zallow-features=to disable support for all#![feature], but this doesn't affect commandline flags and doesn't work on stable either.Rollup merge of rust-lang#132993 - jieyouxu:i_am_very_stable, r=cheny…
Unrolled build for rust-lang#132993
jieyouxu commentedon Nov 18, 2024
Update: #132993 has now merged to support
RUSTC_BOOTSTRAP=-1to mean "pretend I am a stable compiler".jieyouxu commentedon Jan 2, 2025
For future reference, while you can force a given
rustc(well, later than #132993 of course) to pretend to be stable for all intents and purposes, there will still be an important caveat:the
masterornightlyorbetarustc will almost certainly contain changes that are not present in the actualstablerustc (unavoidable), which is something important to keep in mind.That being said, I think we can consider this feature request to be sufficiently satisfied via
RUSTC_BOOTSTRAP=-1.Kobzol commentedon Oct 2, 2026
This didn't actually enable testing stable output in UI tests, because compiletest unconditionally passes certain
-Zflags, and that breaks if you truly makerustcact like stable. We needed-2all along (#163664), which acts as stable, but allows unstable compiler flags 😆