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.

Differential Revision: https://phabricator.services.mozilla.com/D236028
This commit is contained in:
Erich Gubler
2025-02-18 05:46:18 +00:00
parent 082a3f7103
commit 9b51440e71
6 changed files with 55 additions and 19 deletions

View File

@@ -57,7 +57,7 @@ exclude = [
resolver = "2"
[workspace.package]
rust-version = "1.76.0"
rust-version = "1.82.0"
[workspace.dependencies]
# Shared across multiple UniFFI consumers.

View File

@@ -1,21 +1,21 @@
Teaches Rust's build system to vendor std's dependencies into the
rust-src component.
Teaches Rust's build system to vendor `std`'s dependencies into the
`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
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
their contents are ignored in favour of the actual stdlib.
For firefox's purposes, these patches still work fine, and are necessary
to make -Zbuild-std work in a vendored environment.
For Firefox's purposes, these patches still work fine, and are necessary
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
index 012d64e5344..aedb53358ef 100644
index 58f86aa996d..ef8c1584011 100644
--- a/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));
}
@@ -40,7 +40,11 @@ index 012d64e5344..aedb53358ef 100644
+ cmd.env("RUSTC_BOOTSTRAP", "1");
+ builder.info("Dist src");
+ 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);
+
@@ -48,10 +52,10 @@ index 012d64e5344..aedb53358ef 100644
}
}
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
+++ 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
}
@@ -65,7 +69,7 @@ index 5ed6b357e20..ad617948c4b 100644
+ if src == dst {
+ return;
+ }
+ let _ = fs::remove_file(&dst);
+ let _ = fs::remove_file(dst);
+ let metadata = t!(src.symlink_metadata());
+ if let Err(e) = fs::copy(src, dst) {
+ panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e)
@@ -82,3 +86,32 @@ index 5ed6b357e20..ad617948c4b 100644
/// Links a file from `src` to `dst`.
/// Attempts to use hard links if possible, falling back to copying.
/// You can neither rely on this being a copy nor it being a link,
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 = [

View File

@@ -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 136 | Rust 1.84.0 | 1.76.0 | 2025 January 9 | 2025 January 30 | 2025 March 4
| **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 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

View File

@@ -13,7 +13,7 @@ from mach.site import PythonVirtualenv
from mach.util import get_state_dir
# 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):

View File

@@ -379,7 +379,10 @@ rust-1.81.0:
type: git
include-dot-git: true
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:
description: Rust nightly source code

View File

@@ -11,12 +11,12 @@ task-defaults:
script: repack_rust.py
toolchain-artifact: public/build/rustc.tar.zst
linux64-rust-1.76:
linux64-rust-1.82:
treeherder:
symbol: TL(rust-1.76)
symbol: TL(rust-1.82)
run:
arguments: [
'--channel', '1.76.0',
'--channel', '1.82.0',
'--host', 'x86_64-unknown-linux-gnu',
'--target', 'x86_64-unknown-linux-gnu',
'--target', 'i686-unknown-linux-gnu',