diff options
| author | bors <bors@rust-lang.org> | 2025-01-11 09:17:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-11 09:17:06 +0000 |
| commit | ce55b2052db2c9d6deb2dbc5cb2f56d163515a99 (patch) | |
| tree | fda99f960dd0018bd6b9aeda8153cfe962946d88 /src | |
| parent | 7e4077d06fc073442c567d58885b47ed2c5121b8 (diff) | |
| parent | 46222ce6f804c1e3d1ffbeb2029bfd513e42f34f (diff) | |
Auto merge of #135357 - jhpratt:rollup-gs00yt3, r=jhpratt
Rollup of 6 pull requests Successful merges: - #134074 (bootstrap: `std::io::ErrorKind::CrossesDevices` is finally stable) - #135236 (Update a bunch of library types for MCP807) - #135301 (re-add a warning for old master branch, but with much simpler logic) - #135324 (Initial fs module for uefi) - #135326 (support target specific `optimized-compiler-builtins`) - #135347 (Use `NonNull::without_provenance` within the standard library) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/src/core/build_steps/compile.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/format.rs | 3 | ||||
| -rw-r--r-- | src/bootstrap/src/core/config/config.rs | 13 | ||||
| -rw-r--r-- | src/bootstrap/src/core/config/tests.rs | 9 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/change_tracker.rs | 5 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/helpers.rs | 5 |
6 files changed, 31 insertions, 6 deletions
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 2dc3873569e..ce8e7e6eb2b 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -469,7 +469,7 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car // If `compiler-rt` is available ensure that the `c` feature of the // `compiler-builtins` crate is enabled and it's configured to learn where // `compiler-rt` is located. - let compiler_builtins_c_feature = if builder.config.optimized_compiler_builtins { + let compiler_builtins_c_feature = if builder.config.optimized_compiler_builtins(target) { // NOTE: this interacts strangely with `llvm-has-rust-patches`. In that case, we enforce `submodules = false`, so this is a no-op. // But, the user could still decide to manually use an in-tree submodule. // diff --git a/src/bootstrap/src/core/build_steps/format.rs b/src/bootstrap/src/core/build_steps/format.rs index f15e0f38e69..590da1fb514 100644 --- a/src/bootstrap/src/core/build_steps/format.rs +++ b/src/bootstrap/src/core/build_steps/format.rs @@ -114,6 +114,9 @@ fn print_paths(verb: &str, adjective: Option<&str>, paths: &[String]) { } else { println!("fmt: {verb} {len} {adjective}files"); } + if len > 1000 && !CiEnv::is_ci() { + println!("hint: if this number seems too high, try running `git fetch origin master"); + } } pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) { diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index acabfc3685e..026380a46c6 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -634,6 +634,7 @@ pub struct Target { pub runner: Option<String>, pub no_std: bool, pub codegen_backends: Option<Vec<String>>, + pub optimized_compiler_builtins: Option<bool>, } impl Target { @@ -1219,6 +1220,7 @@ define_config! { no_std: Option<bool> = "no-std", codegen_backends: Option<Vec<String>> = "codegen-backends", runner: Option<String> = "runner", + optimized_compiler_builtins: Option<bool> = "optimized-compiler-builtins", } } @@ -2096,6 +2098,7 @@ impl Config { target.sanitizers = cfg.sanitizers; target.profiler = cfg.profiler; target.rpath = cfg.rpath; + target.optimized_compiler_builtins = cfg.optimized_compiler_builtins; if let Some(ref backends) = cfg.codegen_backends { let available_backends = ["llvm", "cranelift", "gcc"]; @@ -2609,6 +2612,13 @@ impl Config { self.target_config.get(&target).and_then(|t| t.rpath).unwrap_or(self.rust_rpath) } + pub fn optimized_compiler_builtins(&self, target: TargetSelection) -> bool { + self.target_config + .get(&target) + .and_then(|t| t.optimized_compiler_builtins) + .unwrap_or(self.optimized_compiler_builtins) + } + pub fn llvm_enabled(&self, target: TargetSelection) -> bool { self.codegen_backends(target).contains(&"llvm".to_owned()) } @@ -3162,6 +3172,9 @@ fn check_incompatible_options_for_ci_rustc( let profiler = &ci_cfg.profiler; err!(current_cfg.profiler, profiler, "build"); + + let optimized_compiler_builtins = &ci_cfg.optimized_compiler_builtins; + err!(current_cfg.optimized_compiler_builtins, optimized_compiler_builtins, "build"); } } diff --git a/src/bootstrap/src/core/config/tests.rs b/src/bootstrap/src/core/config/tests.rs index 24f932a1724..c5e578ff351 100644 --- a/src/bootstrap/src/core/config/tests.rs +++ b/src/bootstrap/src/core/config/tests.rs @@ -120,6 +120,7 @@ fn override_toml() { "--set=change-id=1".to_owned(), "--set=rust.lto=fat".to_owned(), "--set=rust.deny-warnings=false".to_owned(), + "--set=build.optimized-compiler-builtins=true".to_owned(), "--set=build.gdb=\"bar\"".to_owned(), "--set=build.tools=[\"cargo\"]".to_owned(), "--set=llvm.build-config={\"foo\" = \"bar\"}".to_owned(), @@ -127,6 +128,7 @@ fn override_toml() { "--set=target.x86_64-unknown-linux-gnu.rpath=false".to_owned(), "--set=target.aarch64-unknown-linux-gnu.sanitizers=false".to_owned(), "--set=target.aarch64-apple-darwin.runner=apple".to_owned(), + "--set=target.aarch64-apple-darwin.optimized-compiler-builtins=false".to_owned(), ]), |&_| { toml::from_str( @@ -167,6 +169,7 @@ runner = "x86_64-runner" ); assert_eq!(config.gdb, Some("bar".into()), "setting string value with quotes"); assert!(!config.deny_warnings, "setting boolean value"); + assert!(config.optimized_compiler_builtins, "setting boolean value"); assert_eq!( config.tools, Some(["cargo".to_string()].into_iter().collect()), @@ -193,7 +196,11 @@ runner = "x86_64-runner" ..Default::default() }; let darwin = TargetSelection::from_user("aarch64-apple-darwin"); - let darwin_values = Target { runner: Some("apple".into()), ..Default::default() }; + let darwin_values = Target { + runner: Some("apple".into()), + optimized_compiler_builtins: Some(false), + ..Default::default() + }; assert_eq!( config.target_config, [(x86_64, x86_64_values), (aarch64, aarch64_values), (darwin, darwin_values)] diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs index 8fd6c8aa23a..75c9c677ff5 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -325,4 +325,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ severity: ChangeSeverity::Warning, summary: "Removed `rust.parallel-compiler` as it was deprecated in #132282 long time ago.", }, + ChangeInfo { + change_id: 135326, + severity: ChangeSeverity::Warning, + summary: "It is now possible to configure `optimized-compiler-builtins` for per target.", + }, ]; diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs index 3657d9b3112..50fea43aee0 100644 --- a/src/bootstrap/src/utils/helpers.rs +++ b/src/bootstrap/src/utils/helpers.rs @@ -181,10 +181,7 @@ pub fn symlink_dir(config: &Config, original: &Path, link: &Path) -> io::Result< /// copy and remove the file otherwise pub fn move_file<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> { match fs::rename(&from, &to) { - // FIXME: Once `ErrorKind::CrossesDevices` is stabilized use - // if e.kind() == io::ErrorKind::CrossesDevices { - #[cfg(unix)] - Err(e) if e.raw_os_error() == Some(libc::EXDEV) => { + Err(e) if e.kind() == io::ErrorKind::CrossesDevices => { std::fs::copy(&from, &to)?; std::fs::remove_file(&from) } |
