Skip to content
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

Account for env var RUSTC_BOOTSTRAP when determining if features are supported #9

Closed
wants to merge 1 commit into from

Conversation

estebank
Copy link

@SergioBenitez
Copy link
Owner

Is there official documentation for the RUSTC_BOOTSTRAP environment variable anywhere? I'd like to know when it was introduced, for what reason, and whether it is something that will remain in the compiler. In other words, I'd like to better understand the purpose of the flag.

@estebank
Copy link
Author

RUSTC_BOOTSTRAP=1 is used to be able to build any version of rustc using a compatible stable rustc. It tells a stable build of rustc to behave as if it were a nightly build, allowing unstable features to be used. It should't be encouraged, but it is a tool that is available. Supporting this makes version_check behave inline with rustc. Given that supports_features is a convenience to verify whether unstable features will be able to be used in the current compilation, I am inclined to argue that this new behavior is the correct one.

rust-lang/rust#31847 (comment) hints at the unlikelihood of this var going away in the short term.

The (lengthy) discussion in rust-lang/cargo#6608 and rust-lang/cargo#6627 elaborates on the current uses and counter arguments against using this environment variable.

The "documentation" of RUSTC_BOOTSTRAP is only the code (😢):

https://github.com/rust-lang/rust/blob/885c7dfddcca11fa543d99d702c024c3f6bfe07b/src/libtest/lib.rs#L515-L523

https://github.com/rust-lang/rust/blob/8e948df707ea8a3c88c65bf2ffdcb2f1cf5491be/src/libsyntax/feature_gate.rs#L2534-L2553

It also seems to me that support for CFG_DISABLE_UNSTABLE_FEATURES=1 should be added too to fully map against rustc's behavior.

@SergioBenitez
Copy link
Owner

@estebank Is RUSTC_BOOTSTRAP intended to be used by end-users?

In any case, the use in the code snippets you refer to seems to imply that setting RUSTC_BOOTSTRAP effectively makes the stable compiler act like a nightly compiler. As such, I would argue that the correct way to support this feature is to modify Channel::read() accordingly, making a note of the behavior.

@estebank
Copy link
Author

@estebank Is RUSTC_BOOTSTRAP intended to be used by end-users?

It is not necessarily, but it is being used (most notably by Firefox), but it immediately lowers the assurances that stable rustc gives to those of nightly. This is used in environments where people wishes they could be using stable, but are reliant on a subset of unstable features. rust-lang/cargo#6627 is an attempt at formalizing this in a controlled manner, and the pushback is against making RUSTC_BOOTSTRAP part of our stable API.

In any case, the use in the code snippets you refer to seems to imply that setting RUSTC_BOOTSTRAP effectively makes the stable compiler act like a nightly compiler. As such, I would argue that the correct way to support this feature is to modify Channel::read() accordingly, making a note of the behavior.

That sounds reasonable to me, but I'm not sure. I believe that the primary intent for the flag is to affect features.

@Centril
Copy link

Centril commented Jul 2, 2019

@estebank Is RUSTC_BOOTSTRAP intended to be used by end-users?

It should unequivocally not be used by end users.
The flag may be renamed, removed, checked for tampering, etc. at any time.

I'm against giving RUSTC_BOOTSTRAP any more visibility than it already has.
I think it should remain something obscure.

@SergioBenitez
Copy link
Owner

Apologies. I meant to close this nearly a year ago. I don't think we should be listening to hidden/private values that may change, especially since this can be done on a case-by-case basis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow use with RUSTC_BOOTSTRAP
3 participants