mirror of
				https://github.com/mozilla/gecko-dev.git
				synced 2025-11-04 02:09:05 +02:00 
			
		
		
		
	Bug 1945020 - build(rust): bump minimum Rust version 1.76 → 1.82 r=glandium
…but for ASAN/TSAN, use a hack: a 1.82.0 nightly commit that tolerates `unsafe extern` blocks, but doesn't break our current toolchain patches. We also remove the `host_or_target_str` check in `build/moz.configure/toolchain.configure`, at @glandium's suggestion. To quote him: > [This] essentially undoes bug 1806040 but that bug predates other > linker related changes, and I think the discrepancy host/target is not > necessary anymore. Differential Revision: https://phabricator.services.mozilla.com/D236028
This commit is contained in:
		
							parent
							
								
									21aad97aa5
								
							
						
					
					
						commit
						8fa1b7703c
					
				
					 8 changed files with 64 additions and 24 deletions
				
			
		| 
						 | 
					@ -57,7 +57,7 @@ exclude = [
 | 
				
			||||||
resolver = "2"
 | 
					resolver = "2"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[workspace.package]
 | 
					[workspace.package]
 | 
				
			||||||
rust-version = "1.76.0"
 | 
					rust-version = "1.82.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[workspace.dependencies]
 | 
					[workspace.dependencies]
 | 
				
			||||||
# Shared across multiple UniFFI consumers.
 | 
					# Shared across multiple UniFFI consumers.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										35
									
								
								build/build-rust/rust-compiler-intrinsics.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								build/build-rust/rust-compiler-intrinsics.patch
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,35 @@
 | 
				
			||||||
 | 
					The version of `rustc` we build had some `compiler-builtins` updates that broke stuff. Later version
 | 
				
			||||||
 | 
					of rustc in the 1.82 train landed more `compiler-builtins` updates that unbroke the stuff. We need at
 | 
				
			||||||
 | 
					least some of that to make the version of rustc we landed on work.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					See also: <https://github.com/rust-lang/rust/pull/128691>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml
 | 
				
			||||||
 | 
					index 479eb0a2ba..82d5893dc5 100644
 | 
				
			||||||
 | 
					--- a/library/alloc/Cargo.toml
 | 
				
			||||||
 | 
					+++ b/library/alloc/Cargo.toml
 | 
				
			||||||
 | 
					@@ -10,10 +10,7 @@
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 [dependencies]
 | 
				
			||||||
 | 
					 core = { path = "../core" }
 | 
				
			||||||
 | 
					-compiler_builtins = { version = "0.1.114", features = ['rustc-dep-of-std'] }
 | 
				
			||||||
 | 
					-
 | 
				
			||||||
 | 
					-[target.'cfg(not(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")))'.dependencies]
 | 
				
			||||||
 | 
					-compiler_builtins = { version = "0.1.114", features = ["no-f16-f128"] }
 | 
				
			||||||
 | 
					+compiler_builtins = { version = "0.1.117", features = ['rustc-dep-of-std'] }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 [dev-dependencies]
 | 
				
			||||||
 | 
					 rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
 | 
				
			||||||
 | 
					diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml
 | 
				
			||||||
 | 
					index fe601855cc..06e818fb7c 100644
 | 
				
			||||||
 | 
					--- a/library/std/Cargo.toml
 | 
				
			||||||
 | 
					+++ b/library/std/Cargo.toml
 | 
				
			||||||
 | 
					@@ -17,7 +17,7 @@
 | 
				
			||||||
 | 
					 panic_unwind = { path = "../panic_unwind", optional = true }
 | 
				
			||||||
 | 
					 panic_abort = { path = "../panic_abort" }
 | 
				
			||||||
 | 
					 core = { path = "../core", public = true }
 | 
				
			||||||
 | 
					-compiler_builtins = { version = "0.1.114" }
 | 
				
			||||||
 | 
					+compiler_builtins = { version = "0.1.117" }
 | 
				
			||||||
 | 
					 profiler_builtins = { path = "../profiler_builtins", optional = true }
 | 
				
			||||||
 | 
					 unwind = { path = "../unwind" }
 | 
				
			||||||
 | 
					 hashbrown = { version = "0.14", default-features = false, features = [
 | 
				
			||||||
| 
						 | 
					@ -1,21 +1,21 @@
 | 
				
			||||||
Teaches Rust's build system to vendor std's dependencies into the
 | 
					Teaches Rust's build system to vendor `std`'s dependencies into the
 | 
				
			||||||
rust-src component.
 | 
					`rust-src` component.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This was originally landed in https://github.com/rust-lang/rust/pull/78790
 | 
					This was originally landed in <https://github.com/rust-lang/rust/pull/78790>,
 | 
				
			||||||
but was backed out for causing some breakage for distro maintainers who
 | 
					but was backed out for causing some breakage for distro maintainers who
 | 
				
			||||||
need to build Rust itself in a vendored/offline context. It doesn't actually
 | 
					need to build Rust itself in a vendored/offline context. It doesn't actually
 | 
				
			||||||
fetch anything interesting from crates.io, just the magic fake std/core crates
 | 
					fetch anything interesting from Crates.io, just the magic fake `std`/`core` crates
 | 
				
			||||||
that exist to make the build work right. Those crates *are* vendored but
 | 
					that exist to make the build work right. Those crates *are* vendored but
 | 
				
			||||||
their contents are ignored in favour of the actual stdlib.
 | 
					their contents are ignored in favour of the actual stdlib.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
For firefox's purposes, these patches still work fine, and are necessary
 | 
					For Firefox's purposes, these patches still work fine, and are necessary
 | 
				
			||||||
to make -Zbuild-std work in a vendored environment.
 | 
					to make `-Zbuild-std` work in a vendored environment.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
 | 
					diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
 | 
				
			||||||
index 012d64e5344..aedb53358ef 100644
 | 
					index 58f86aa996d..ef8c1584011 100644
 | 
				
			||||||
--- a/src/bootstrap/src/core/build_steps/dist.rs
 | 
					--- a/src/bootstrap/src/core/build_steps/dist.rs
 | 
				
			||||||
+++ b/src/bootstrap/src/core/build_steps/dist.rs
 | 
					+++ b/src/bootstrap/src/core/build_steps/dist.rs
 | 
				
			||||||
@@ -927,6 +927,31 @@ fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
 | 
					@@ -941,6 +941,35 @@ fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
 | 
				
			||||||
             builder.copy_link(&builder.src.join(file), &dst_src.join(file));
 | 
					             builder.copy_link(&builder.src.join(file), &dst_src.join(file));
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,11 @@ index 012d64e5344..aedb53358ef 100644
 | 
				
			||||||
+        cmd.env("RUSTC_BOOTSTRAP", "1");
 | 
					+        cmd.env("RUSTC_BOOTSTRAP", "1");
 | 
				
			||||||
+        builder.info("Dist src");
 | 
					+        builder.info("Dist src");
 | 
				
			||||||
+        let _time = timeit(builder);
 | 
					+        let _time = timeit(builder);
 | 
				
			||||||
+        builder.run(&mut cmd);
 | 
					+        builder.run(
 | 
				
			||||||
 | 
					+            &mut cmd,
 | 
				
			||||||
 | 
					+            crate::utils::exec::OutputMode::Print,
 | 
				
			||||||
 | 
					+            crate::utils::exec::OutputMode::Print,
 | 
				
			||||||
 | 
					+        );
 | 
				
			||||||
+
 | 
					+
 | 
				
			||||||
+        builder.remove(&temp_lock);
 | 
					+        builder.remove(&temp_lock);
 | 
				
			||||||
+
 | 
					+
 | 
				
			||||||
| 
						 | 
					@ -48,10 +52,10 @@ index 012d64e5344..aedb53358ef 100644
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
 }
 | 
					 }
 | 
				
			||||||
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
 | 
					diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
 | 
				
			||||||
index 5ed6b357e20..ad617948c4b 100644
 | 
					index 453fb39327d..af579af9eca 100644
 | 
				
			||||||
--- a/src/bootstrap/src/lib.rs
 | 
					--- a/src/bootstrap/src/lib.rs
 | 
				
			||||||
+++ b/src/bootstrap/src/lib.rs
 | 
					+++ b/src/bootstrap/src/lib.rs
 | 
				
			||||||
@@ -1649,6 +1649,30 @@ fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, DependencyType)> {
 | 
					@@ -1732,6 +1732,30 @@ fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, DependencyType)> {
 | 
				
			||||||
         paths
 | 
					         paths
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
| 
						 | 
					@ -65,7 +69,7 @@ index 5ed6b357e20..ad617948c4b 100644
 | 
				
			||||||
+        if src == dst {
 | 
					+        if src == dst {
 | 
				
			||||||
+            return;
 | 
					+            return;
 | 
				
			||||||
+        }
 | 
					+        }
 | 
				
			||||||
+        let _ = fs::remove_file(&dst);
 | 
					+        let _ = fs::remove_file(dst);
 | 
				
			||||||
+        let metadata = t!(src.symlink_metadata());
 | 
					+        let metadata = t!(src.symlink_metadata());
 | 
				
			||||||
+        if let Err(e) = fs::copy(src, dst) {
 | 
					+        if let Err(e) = fs::copy(src, dst) {
 | 
				
			||||||
+            panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e)
 | 
					+            panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2052,11 +2052,7 @@ def select_linker_tmpl(host_or_target):
 | 
				
			||||||
            and (
 | 
					            and (
 | 
				
			||||||
                (
 | 
					                (
 | 
				
			||||||
                    target.kernel != "Darwin"
 | 
					                    target.kernel != "Darwin"
 | 
				
			||||||
                    and (
 | 
					                    and (developer_options or c_compiler.version >= "15.0")
 | 
				
			||||||
                        developer_options
 | 
					 | 
				
			||||||
                        or host_or_target_str == "host"
 | 
					 | 
				
			||||||
                        or c_compiler.version >= "15.0"
 | 
					 | 
				
			||||||
                    )
 | 
					 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
                or (
 | 
					                or (
 | 
				
			||||||
                    target.kernel == "Darwin"
 | 
					                    target.kernel == "Darwin"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -164,7 +164,7 @@ Here are the Rust versions for each Firefox version.
 | 
				
			||||||
| Firefox 135 | Rust 1.83.0 | 1.76.0 | 2024 November 28 | 2025 January 2 | 2025 February 4
 | 
					| Firefox 135 | Rust 1.83.0 | 1.76.0 | 2024 November 28 | 2025 January 2 | 2025 February 4
 | 
				
			||||||
| Firefox 136 | Rust 1.84.0 | 1.76.0 | 2025 January 9 | 2025 January 30 | 2025 March 4
 | 
					| Firefox 136 | Rust 1.84.0 | 1.76.0 | 2025 January 9 | 2025 January 30 | 2025 March 4
 | 
				
			||||||
| **Estimated** |
 | 
					| **Estimated** |
 | 
				
			||||||
| Firefox 137 | Rust 1.85.0 | ? | 2025 February 20 | 2025 February 27 | 2025 April 1
 | 
					| Firefox 137 | Rust 1.85.0 | 1.82.0 | 2025 February 20 | 2025 February 27 | 2025 April 1
 | 
				
			||||||
| Firefox 138 | Rust 1.85.0 | ? | 2025 February 20 | 2025 March 27 | 2025 April 29
 | 
					| Firefox 138 | Rust 1.85.0 | ? | 2025 February 20 | 2025 March 27 | 2025 April 29
 | 
				
			||||||
| Firefox 139 | Rust 1.86.0 | ? | 2025 April 3 | 2025 April 24 | 2025 May 27
 | 
					| Firefox 139 | Rust 1.86.0 | ? | 2025 April 3 | 2025 April 24 | 2025 May 27
 | 
				
			||||||
| Firefox 140 | Rust 1.87.0 | ? | 2025 May 15 | 2025 May 22 | 2025 June 24
 | 
					| Firefox 140 | Rust 1.87.0 | ? | 2025 May 15 | 2025 May 22 | 2025 June 24
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,7 +13,7 @@ from mach.site import PythonVirtualenv
 | 
				
			||||||
from mach.util import get_state_dir
 | 
					from mach.util import get_state_dir
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Keep in sync with rust-version in top-level Cargo.toml.
 | 
					# Keep in sync with rust-version in top-level Cargo.toml.
 | 
				
			||||||
MINIMUM_RUST_VERSION = "1.76.0"
 | 
					MINIMUM_RUST_VERSION = "1.82.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_tools_dir(srcdir=False):
 | 
					def get_tools_dir(srcdir=False):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -386,7 +386,10 @@ rust-1.81.0:
 | 
				
			||||||
        type: git
 | 
					        type: git
 | 
				
			||||||
        include-dot-git: true
 | 
					        include-dot-git: true
 | 
				
			||||||
        repo: https://github.com/rust-lang/rust/
 | 
					        repo: https://github.com/rust-lang/rust/
 | 
				
			||||||
        revision: eeb90cda1969383f56a2637cbd3037bdf598841c
 | 
					        # NOTE: This is 1.81.0 and then some, to accommodate compiling some 1.82.0 code without
 | 
				
			||||||
 | 
					        # breaking patches we use for sanitizers. See
 | 
				
			||||||
 | 
					        # <https://bugzilla.mozilla.org/show_bug.cgi?id=1915537> for follow-up.
 | 
				
			||||||
 | 
					        revision: ab1527f1d6560168f9fd36fa8cd7ba677c1d36ad
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rust-nightly:
 | 
					rust-nightly:
 | 
				
			||||||
    description: Rust nightly source code
 | 
					    description: Rust nightly source code
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,12 +11,12 @@ task-defaults:
 | 
				
			||||||
        script: repack_rust.py
 | 
					        script: repack_rust.py
 | 
				
			||||||
        toolchain-artifact: public/build/rustc.tar.zst
 | 
					        toolchain-artifact: public/build/rustc.tar.zst
 | 
				
			||||||
 | 
					
 | 
				
			||||||
linux64-rust-1.76:
 | 
					linux64-rust-1.82:
 | 
				
			||||||
    treeherder:
 | 
					    treeherder:
 | 
				
			||||||
        symbol: TL(rust-1.76)
 | 
					        symbol: TL(rust-1.82)
 | 
				
			||||||
    run:
 | 
					    run:
 | 
				
			||||||
        arguments: [
 | 
					        arguments: [
 | 
				
			||||||
            '--channel', '1.76.0',
 | 
					            '--channel', '1.82.0',
 | 
				
			||||||
            '--host', 'x86_64-unknown-linux-gnu',
 | 
					            '--host', 'x86_64-unknown-linux-gnu',
 | 
				
			||||||
            '--target', 'x86_64-unknown-linux-gnu',
 | 
					            '--target', 'x86_64-unknown-linux-gnu',
 | 
				
			||||||
            '--target', 'i686-unknown-linux-gnu',
 | 
					            '--target', 'i686-unknown-linux-gnu',
 | 
				
			||||||
| 
						 | 
					@ -110,6 +110,7 @@ linux64-rust-1.81-dev:
 | 
				
			||||||
            RUSTFLAGS_NOT_BOOTSTRAP: '-Clink-arg=-Wl,--undefined-version'
 | 
					            RUSTFLAGS_NOT_BOOTSTRAP: '-Clink-arg=-Wl,--undefined-version'
 | 
				
			||||||
    run:
 | 
					    run:
 | 
				
			||||||
        arguments: [
 | 
					        arguments: [
 | 
				
			||||||
 | 
					            '--patch', 'rust-compiler-intrinsics.patch',
 | 
				
			||||||
            '--patch', 'rust-vendor-std.patch',
 | 
					            '--patch', 'rust-vendor-std.patch',
 | 
				
			||||||
            '--patch', 'src/tools/cargo:cargo-vendor-std-1.79.patch',
 | 
					            '--patch', 'src/tools/cargo:cargo-vendor-std-1.79.patch',
 | 
				
			||||||
            '--channel', 'dev',
 | 
					            '--channel', 'dev',
 | 
				
			||||||
| 
						 | 
					@ -117,6 +118,7 @@ linux64-rust-1.81-dev:
 | 
				
			||||||
            '--target', 'x86_64-unknown-linux-gnu',
 | 
					            '--target', 'x86_64-unknown-linux-gnu',
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
        resources:
 | 
					        resources:
 | 
				
			||||||
 | 
					            - build/build-rust/rust-compiler-intrinsics.patch
 | 
				
			||||||
            - build/build-rust/rust-vendor-std.patch
 | 
					            - build/build-rust/rust-vendor-std.patch
 | 
				
			||||||
            - build/build-rust/cargo-vendor-std-1.79.patch
 | 
					            - build/build-rust/cargo-vendor-std-1.79.patch
 | 
				
			||||||
        toolchain-alias:
 | 
					        toolchain-alias:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue