Skip to content

Commit 8fa1b77

Browse files
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
1 parent 21aad97 commit 8fa1b77

File tree

8 files changed

+64
-24
lines changed

8 files changed

+64
-24
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ exclude = [
5757
resolver = "2"
5858

5959
[workspace.package]
60-
rust-version = "1.76.0"
60+
rust-version = "1.82.0"
6161

6262
[workspace.dependencies]
6363
# Shared across multiple UniFFI consumers.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
The version of `rustc` we build had some `compiler-builtins` updates that broke stuff. Later version
2+
of rustc in the 1.82 train landed more `compiler-builtins` updates that unbroke the stuff. We need at
3+
least some of that to make the version of rustc we landed on work.
4+
5+
See also: <https://github.com/rust-lang/rust/pull/128691>
6+
7+
diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml
8+
index 479eb0a2ba..82d5893dc5 100644
9+
--- a/library/alloc/Cargo.toml
10+
+++ b/library/alloc/Cargo.toml
11+
@@ -10,10 +10,7 @@
12+
13+
[dependencies]
14+
core = { path = "../core" }
15+
-compiler_builtins = { version = "0.1.114", features = ['rustc-dep-of-std'] }
16+
-
17+
-[target.'cfg(not(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")))'.dependencies]
18+
-compiler_builtins = { version = "0.1.114", features = ["no-f16-f128"] }
19+
+compiler_builtins = { version = "0.1.117", features = ['rustc-dep-of-std'] }
20+
21+
[dev-dependencies]
22+
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
23+
diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml
24+
index fe601855cc..06e818fb7c 100644
25+
--- a/library/std/Cargo.toml
26+
+++ b/library/std/Cargo.toml
27+
@@ -17,7 +17,7 @@
28+
panic_unwind = { path = "../panic_unwind", optional = true }
29+
panic_abort = { path = "../panic_abort" }
30+
core = { path = "../core", public = true }
31+
-compiler_builtins = { version = "0.1.114" }
32+
+compiler_builtins = { version = "0.1.117" }
33+
profiler_builtins = { path = "../profiler_builtins", optional = true }
34+
unwind = { path = "../unwind" }
35+
hashbrown = { version = "0.14", default-features = false, features = [

build/build-rust/rust-vendor-std.patch

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
Teaches Rust's build system to vendor std's dependencies into the
2-
rust-src component.
1+
Teaches Rust's build system to vendor `std`'s dependencies into the
2+
`rust-src` component.
33

4-
This was originally landed in https://github.com/rust-lang/rust/pull/78790
4+
This was originally landed in <https://github.com/rust-lang/rust/pull/78790>,
55
but was backed out for causing some breakage for distro maintainers who
66
need to build Rust itself in a vendored/offline context. It doesn't actually
7-
fetch anything interesting from crates.io, just the magic fake std/core crates
7+
fetch anything interesting from Crates.io, just the magic fake `std`/`core` crates
88
that exist to make the build work right. Those crates *are* vendored but
99
their contents are ignored in favour of the actual stdlib.
1010

11-
For firefox's purposes, these patches still work fine, and are necessary
12-
to make -Zbuild-std work in a vendored environment.
11+
For Firefox's purposes, these patches still work fine, and are necessary
12+
to make `-Zbuild-std` work in a vendored environment.
1313

1414
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
15-
index 012d64e5344..aedb53358ef 100644
15+
index 58f86aa996d..ef8c1584011 100644
1616
--- a/src/bootstrap/src/core/build_steps/dist.rs
1717
+++ b/src/bootstrap/src/core/build_steps/dist.rs
18-
@@ -927,6 +927,31 @@ fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
18+
@@ -941,6 +941,35 @@ fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
1919
builder.copy_link(&builder.src.join(file), &dst_src.join(file));
2020
}
2121

@@ -40,18 +40,22 @@ index 012d64e5344..aedb53358ef 100644
4040
+ cmd.env("RUSTC_BOOTSTRAP", "1");
4141
+ builder.info("Dist src");
4242
+ let _time = timeit(builder);
43-
+ builder.run(&mut cmd);
43+
+ builder.run(
44+
+ &mut cmd,
45+
+ crate::utils::exec::OutputMode::Print,
46+
+ crate::utils::exec::OutputMode::Print,
47+
+ );
4448
+
4549
+ builder.remove(&temp_lock);
4650
+
4751
tarball.generate()
4852
}
4953
}
5054
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
51-
index 5ed6b357e20..ad617948c4b 100644
55+
index 453fb39327d..af579af9eca 100644
5256
--- a/src/bootstrap/src/lib.rs
5357
+++ b/src/bootstrap/src/lib.rs
54-
@@ -1649,6 +1649,30 @@ fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, DependencyType)> {
58+
@@ -1732,6 +1732,30 @@ fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, DependencyType)> {
5559
paths
5660
}
5761

@@ -65,7 +69,7 @@ index 5ed6b357e20..ad617948c4b 100644
6569
+ if src == dst {
6670
+ return;
6771
+ }
68-
+ let _ = fs::remove_file(&dst);
72+
+ let _ = fs::remove_file(dst);
6973
+ let metadata = t!(src.symlink_metadata());
7074
+ if let Err(e) = fs::copy(src, dst) {
7175
+ panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e)

build/moz.configure/toolchain.configure

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,11 +2052,7 @@ def select_linker_tmpl(host_or_target):
20522052
and (
20532053
(
20542054
target.kernel != "Darwin"
2055-
and (
2056-
developer_options
2057-
or host_or_target_str == "host"
2058-
or c_compiler.version >= "15.0"
2059-
)
2055+
and (developer_options or c_compiler.version >= "15.0")
20602056
)
20612057
or (
20622058
target.kernel == "Darwin"

docs/writing-rust-code/update-policy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Here are the Rust versions for each Firefox version.
164164
| Firefox 135 | Rust 1.83.0 | 1.76.0 | 2024 November 28 | 2025 January 2 | 2025 February 4
165165
| Firefox 136 | Rust 1.84.0 | 1.76.0 | 2025 January 9 | 2025 January 30 | 2025 March 4
166166
| **Estimated** |
167-
| Firefox 137 | Rust 1.85.0 | ? | 2025 February 20 | 2025 February 27 | 2025 April 1
167+
| Firefox 137 | Rust 1.85.0 | 1.82.0 | 2025 February 20 | 2025 February 27 | 2025 April 1
168168
| Firefox 138 | Rust 1.85.0 | ? | 2025 February 20 | 2025 March 27 | 2025 April 29
169169
| Firefox 139 | Rust 1.86.0 | ? | 2025 April 3 | 2025 April 24 | 2025 May 27
170170
| Firefox 140 | Rust 1.87.0 | ? | 2025 May 15 | 2025 May 22 | 2025 June 24

python/mozboot/mozboot/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from mach.util import get_state_dir
1414

1515
# Keep in sync with rust-version in top-level Cargo.toml.
16-
MINIMUM_RUST_VERSION = "1.76.0"
16+
MINIMUM_RUST_VERSION = "1.82.0"
1717

1818

1919
def get_tools_dir(srcdir=False):

taskcluster/kinds/fetch/toolchains.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,10 @@ rust-1.81.0:
386386
type: git
387387
include-dot-git: true
388388
repo: https://github.com/rust-lang/rust/
389-
revision: eeb90cda1969383f56a2637cbd3037bdf598841c
389+
# NOTE: This is 1.81.0 and then some, to accommodate compiling some 1.82.0 code without
390+
# breaking patches we use for sanitizers. See
391+
# <https://bugzilla.mozilla.org/show_bug.cgi?id=1915537> for follow-up.
392+
revision: ab1527f1d6560168f9fd36fa8cd7ba677c1d36ad
390393

391394
rust-nightly:
392395
description: Rust nightly source code

taskcluster/kinds/toolchain/rust.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ task-defaults:
1111
script: repack_rust.py
1212
toolchain-artifact: public/build/rustc.tar.zst
1313

14-
linux64-rust-1.76:
14+
linux64-rust-1.82:
1515
treeherder:
16-
symbol: TL(rust-1.76)
16+
symbol: TL(rust-1.82)
1717
run:
1818
arguments: [
19-
'--channel', '1.76.0',
19+
'--channel', '1.82.0',
2020
'--host', 'x86_64-unknown-linux-gnu',
2121
'--target', 'x86_64-unknown-linux-gnu',
2222
'--target', 'i686-unknown-linux-gnu',
@@ -110,13 +110,15 @@ linux64-rust-1.81-dev:
110110
RUSTFLAGS_NOT_BOOTSTRAP: '-Clink-arg=-Wl,--undefined-version'
111111
run:
112112
arguments: [
113+
'--patch', 'rust-compiler-intrinsics.patch',
113114
'--patch', 'rust-vendor-std.patch',
114115
'--patch', 'src/tools/cargo:cargo-vendor-std-1.79.patch',
115116
'--channel', 'dev',
116117
'--host', 'x86_64-unknown-linux-gnu',
117118
'--target', 'x86_64-unknown-linux-gnu',
118119
]
119120
resources:
121+
- build/build-rust/rust-compiler-intrinsics.patch
120122
- build/build-rust/rust-vendor-std.patch
121123
- build/build-rust/cargo-vendor-std-1.79.patch
122124
toolchain-alias:

0 commit comments

Comments
 (0)