Rollup merge of #152686 - Zalathar:force-unstable, r=jieyouxu
bootstrap: Inline the `is_tool` check for setting `-Zforce-unstable-if-unmarked` `Mode::is_tool` is the sort of method that looks general-purpose, but is only actually used for a very specific purpose, to control the setting of `-Zforce-unstable-if-unmarked`. It is therefore clearer to inline the mode check, which makes it easier to see how the condition affects the result. I have tried to add some comments explaining why we set that flag, but they are based on my own recent investigations, so I'm not 100% confident that they're accurate.
This commit is contained in:
commit
84c522a6b4
2 changed files with 12 additions and 9 deletions
|
|
@ -999,8 +999,18 @@ impl Builder<'_> {
|
|||
cargo.env("UPDATE_EXPECT", "1");
|
||||
}
|
||||
|
||||
if !mode.is_tool() {
|
||||
cargo.env("RUSTC_FORCE_UNSTABLE", "1");
|
||||
// Set an environment variable that tells the rustc/rustdoc wrapper
|
||||
// binary to pass `-Zforce-unstable-if-unmarked` to the real compiler.
|
||||
match mode {
|
||||
// Any library crate that's part of the sysroot should be marked unstable
|
||||
// (including third-party dependencies), unless it uses a staged_api
|
||||
// `#![stable(..)]` attribute to explicitly mark itself stable.
|
||||
Mode::Std | Mode::Codegen | Mode::Rustc => {
|
||||
cargo.env("RUSTC_FORCE_UNSTABLE", "1");
|
||||
}
|
||||
|
||||
// For everything else, crate stability shouldn't matter, so don't set a flag.
|
||||
Mode::ToolBootstrap | Mode::ToolRustcPrivate | Mode::ToolStd | Mode::ToolTarget => {}
|
||||
}
|
||||
|
||||
if let Some(x) = self.crt_static(target) {
|
||||
|
|
|
|||
|
|
@ -340,13 +340,6 @@ pub enum Mode {
|
|||
}
|
||||
|
||||
impl Mode {
|
||||
pub fn is_tool(&self) -> bool {
|
||||
match self {
|
||||
Mode::ToolBootstrap | Mode::ToolRustcPrivate | Mode::ToolStd | Mode::ToolTarget => true,
|
||||
Mode::Std | Mode::Codegen | Mode::Rustc => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn must_support_dlopen(&self) -> bool {
|
||||
match self {
|
||||
Mode::Std | Mode::Codegen => true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue