diff options
| author | bors <bors@rust-lang.org> | 2025-07-22 11:32:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-07-22 11:32:36 +0000 |
| commit | 35487a2e7c80012129c38f55c970109a1538c91f (patch) | |
| tree | 9e370f22e084dea144b776d617d10c23ac655f9e /src/bootstrap | |
| parent | c0b282f0ccdab7523cdb8dfa41b23bed5573da76 (diff) | |
| parent | 749f895d95e1c2da2e82fa47b7311353cd7db7fc (diff) | |
| download | rust-35487a2e7c80012129c38f55c970109a1538c91f.tar.gz rust-35487a2e7c80012129c38f55c970109a1538c91f.zip | |
Auto merge of #144294 - matthiaskrgr:rollup-ybvall3, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang/rust#142454 (Add modern AVR mcus like avr128db28 and attiny3224) - rust-lang/rust#142924 (tidy: move rustdoc js stuff into a tidy extra check) - rust-lang/rust#143373 (Unquerify maybe_unused_trait_imports.) - rust-lang/rust#144082 (tests: cover more `exported_private_dependencies` cases) - rust-lang/rust#144126 (Fix empty target_config in apply_rust_config bootstrap) - rust-lang/rust#144164 ( opt-dist: add an option for setting path to stage0 root) - rust-lang/rust#144265 (Dont ICE on copy error being suppressed due to overflow) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/src/core/builder/tests.rs | 16 | ||||
| -rw-r--r-- | src/bootstrap/src/core/config/config.rs | 3 | ||||
| -rw-r--r-- | src/bootstrap/src/core/config/flags.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/config/toml/rust.rs | 30 |
4 files changed, 46 insertions, 5 deletions
diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index c025a8b15d0..105d4229e75 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -642,6 +642,7 @@ mod snapshot { }; use crate::core::builder::{Builder, Kind, StepDescription, StepMetadata}; use crate::core::config::TargetSelection; + use crate::core::config::toml::rust::with_lld_opt_in_targets; use crate::utils::cache::Cache; use crate::utils::helpers::get_host_target; use crate::utils::tests::{ConfigBuilder, TestCtx}; @@ -1653,6 +1654,21 @@ mod snapshot { } #[test] + fn test_lld_opt_in() { + with_lld_opt_in_targets(vec![host_target()], || { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("build") + .path("compiler") + .render_steps(), @r" + [build] llvm <host> + [build] rustc 0 <host> -> rustc 1 <host> + [build] rustc 0 <host> -> LldWrapper 1 <host> + "); + }); + } + + #[test] fn doc_library_no_std_target() { let ctx = TestCtx::new(); insta::assert_snapshot!( diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 22a75183404..6e04f115424 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -942,6 +942,7 @@ impl Config { config.rust_profile_use = flags_rust_profile_use; config.rust_profile_generate = flags_rust_profile_generate; + config.apply_target_config(toml.target); config.apply_rust_config(toml.rust, flags_warnings); config.reproducible_artifacts = flags_reproducible_artifact; @@ -967,8 +968,6 @@ impl Config { config.apply_gcc_config(toml.gcc); - config.apply_target_config(toml.target); - match ccache { Some(StringOrBool::String(ref s)) => config.ccache = Some(s.to_string()), Some(StringOrBool::Bool(true)) => { diff --git a/src/bootstrap/src/core/config/flags.rs b/src/bootstrap/src/core/config/flags.rs index 1547ca44494..31a427f9ffa 100644 --- a/src/bootstrap/src/core/config/flags.rs +++ b/src/bootstrap/src/core/config/flags.rs @@ -386,7 +386,7 @@ pub enum Subcommand { bless: bool, #[arg(long)] /// comma-separated list of other files types to check (accepts py, py:lint, - /// py:fmt, shell, shell:lint, cpp, cpp:fmt, spellcheck) + /// py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck, spellcheck) /// /// Any argument can be prefixed with "auto:" to only run if /// relevant files are modified (eg. "auto:py"). diff --git a/src/bootstrap/src/core/config/toml/rust.rs b/src/bootstrap/src/core/config/toml/rust.rs index 71fab0e6ae6..c136bd4a6f9 100644 --- a/src/bootstrap/src/core/config/toml/rust.rs +++ b/src/bootstrap/src/core/config/toml/rust.rs @@ -410,6 +410,31 @@ pub(crate) fn validate_codegen_backends(backends: Vec<String>, section: &str) -> backends } +#[cfg(not(test))] +fn default_lld_opt_in_targets() -> Vec<String> { + vec!["x86_64-unknown-linux-gnu".to_string()] +} + +#[cfg(test)] +thread_local! { + static TEST_LLD_OPT_IN_TARGETS: std::cell::RefCell<Option<Vec<String>>> = std::cell::RefCell::new(None); +} + +#[cfg(test)] +fn default_lld_opt_in_targets() -> Vec<String> { + TEST_LLD_OPT_IN_TARGETS.with(|cell| cell.borrow().clone()).unwrap_or_default() +} + +#[cfg(test)] +pub fn with_lld_opt_in_targets<R>(targets: Vec<String>, f: impl FnOnce() -> R) -> R { + TEST_LLD_OPT_IN_TARGETS.with(|cell| { + let prev = cell.replace(Some(targets)); + let result = f(); + cell.replace(prev); + result + }) +} + impl Config { pub fn apply_rust_config(&mut self, toml_rust: Option<Rust>, warnings: Warnings) { let mut debug = None; @@ -617,12 +642,13 @@ impl Config { // thus, disabled // - similarly, lld will not be built nor used by default when explicitly asked not to, e.g. // when the config sets `rust.lld = false` - if self.host_target.triple == "x86_64-unknown-linux-gnu" && self.hosts == [self.host_target] + if default_lld_opt_in_targets().contains(&self.host_target.triple.to_string()) + && self.hosts == [self.host_target] { let no_llvm_config = self .target_config .get(&self.host_target) - .is_some_and(|target_config| target_config.llvm_config.is_none()); + .is_none_or(|target_config| target_config.llvm_config.is_none()); let enable_lld = self.llvm_from_ci || no_llvm_config; // Prefer the config setting in case an explicit opt-out is needed. self.lld_enabled = lld_enabled.unwrap_or(enable_lld); |
