-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Move bootstrap configuration to library workspace #149514
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
Open
adamgemmell
wants to merge
5
commits into
rust-lang:main
Choose a base branch
from
adamgemmell:dev/adagem01/bootstrap-to-library
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+86
−61
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ce86629
Move -Cembed-bitcode
adamgemmell 88a5974
Move frame pointers
adamgemmell 7c01a90
Move debuginfo=1
adamgemmell 890bbd1
Move symbol mangling
adamgemmell 0bae09c
Configure test's unstable feature gate when built outside of bootstrap
adamgemmell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| fn main() { | ||
| println!("cargo:rustc-check-cfg=cfg(enable_unstable_features)"); | ||
|
|
||
| let rustc = std::env::var("RUSTC").unwrap_or_else(|_| "rustc".into()); | ||
| let version = std::process::Command::new(rustc).arg("-vV").output().unwrap(); | ||
| let stdout = String::from_utf8(version.stdout).unwrap(); | ||
|
|
||
| if stdout.contains("nightly") || stdout.contains("dev") { | ||
| println!("cargo:rustc-cfg=enable_unstable_features"); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,9 +103,9 @@ pub struct Cargo { | |
| rustdocflags: Rustflags, | ||
| hostflags: HostFlags, | ||
| allow_features: String, | ||
| release_build: bool, | ||
| build_compiler_stage: u32, | ||
| extra_rustflags: Vec<String>, | ||
| profile: Option<&'static str>, | ||
| } | ||
|
|
||
| impl Cargo { | ||
|
|
@@ -134,7 +134,11 @@ impl Cargo { | |
| } | ||
|
|
||
| pub fn release_build(&mut self, release_build: bool) { | ||
| self.release_build = release_build; | ||
| self.profile = if release_build { Some("release") } else { None }; | ||
| } | ||
|
|
||
| pub fn profile(&mut self, profile: &'static str) { | ||
| self.profile = Some(profile) | ||
| } | ||
|
|
||
| pub fn compiler(&self) -> Compiler { | ||
|
|
@@ -400,8 +404,8 @@ impl Cargo { | |
|
|
||
| impl From<Cargo> for BootstrapCommand { | ||
| fn from(mut cargo: Cargo) -> BootstrapCommand { | ||
| if cargo.release_build { | ||
| cargo.args.insert(0, "--release".into()); | ||
| if let Some(profile) = cargo.profile { | ||
| cargo.args.insert(0, format!("--profile={profile}").into()); | ||
| } | ||
|
|
||
| for arg in &cargo.extra_rustflags { | ||
|
|
@@ -648,23 +652,15 @@ impl Builder<'_> { | |
| rustflags.arg(sysroot_str); | ||
| } | ||
|
|
||
| let use_new_symbol_mangling = match self.config.rust_new_symbol_mangling { | ||
| Some(setting) => { | ||
| // If an explicit setting is given, use that | ||
| setting | ||
| } | ||
| // Per compiler-team#938, v0 mangling is used on nightly | ||
| None if self.config.channel == "dev" || self.config.channel == "nightly" => true, | ||
| None => { | ||
| if mode == Mode::Std { | ||
| // The standard library defaults to the legacy scheme | ||
| false | ||
| } else { | ||
| // The compiler and tools default to the new scheme | ||
| true | ||
| } | ||
| let use_new_symbol_mangling = self.config.rust_new_symbol_mangling.or_else(|| { | ||
| if mode != Mode::Std { | ||
| // The compiler and tools default to the new scheme | ||
| Some(true) | ||
| } else { | ||
| // std follows the flag's default, which per compiler-team#938 is v0 on nightly | ||
| None | ||
| } | ||
| }; | ||
| }); | ||
|
|
||
| // By default, windows-rs depends on a native library that doesn't get copied into the | ||
| // sysroot. Passing this cfg enables raw-dylib support instead, which makes the native | ||
|
|
@@ -675,11 +671,11 @@ impl Builder<'_> { | |
| rustflags.arg("--cfg=windows_raw_dylib"); | ||
| } | ||
|
|
||
| if use_new_symbol_mangling { | ||
| rustflags.arg("-Csymbol-mangling-version=v0"); | ||
| } else { | ||
| rustflags.arg("-Csymbol-mangling-version=legacy"); | ||
| } | ||
| rustflags.arg(match use_new_symbol_mangling { | ||
| Some(true) => "-Csymbol-mangling-version=v0", | ||
| Some(false) => "-Csymbol-mangling-version=legacy", | ||
| None => "", | ||
| }); | ||
|
|
||
| // Always enable move/copy annotations for profiler visibility (non-stage0 only). | ||
| // Note that -Zannotate-moves is only effective with debugging info enabled. | ||
|
|
@@ -1396,9 +1392,18 @@ impl Builder<'_> { | |
| .unwrap_or(&self.config.rust_rustflags) | ||
| .clone(); | ||
|
|
||
| let release_build = self.config.rust_optimize.is_release() && | ||
| // cargo bench/install do not accept `--release` and miri doesn't want it | ||
| !matches!(cmd_kind, Kind::Bench | Kind::Install | Kind::Miri | Kind::MiriSetup | Kind::MiriTest); | ||
| let profile = | ||
| if matches!(cmd_kind, Kind::Bench | Kind::Miri | Kind::MiriSetup | Kind::MiriTest) { | ||
| // Use the default profile for bench/miri | ||
| None | ||
| } else { | ||
| match (mode, self.config.rust_optimize.is_release()) { | ||
| // Some std configuration exists in its own profile | ||
| (Mode::Std, true) => Some("dist"), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| (_, true) => Some("release"), | ||
| (_, false) => Some("dev"), | ||
| } | ||
| }; | ||
|
|
||
| Cargo { | ||
| command: cargo, | ||
|
|
@@ -1409,9 +1414,9 @@ impl Builder<'_> { | |
| rustdocflags, | ||
| hostflags, | ||
| allow_features, | ||
| release_build, | ||
| build_compiler_stage, | ||
| extra_rustflags, | ||
| profile, | ||
| } | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this get unconditionally overridden by the value set for
debuginfo-level-std?