Skip to content

Commit e30d0a0

Browse files
authored
Move to Rust 1.92. Bump MSRV to 1.84. (#1440)
This PR updates the pinned Rust version to 1.92.0 and raises the MSRV to 1.84.0.It also cleans up several legacy workarounds and hacks that are no longer necessary with newer Rust versions.
1 parent 473fd58 commit e30d0a0

File tree

10 files changed

+20
-43
lines changed

10 files changed

+20
-43
lines changed

.github/scripts/ci-common.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ cargo_toml=$project_root/Cargo.toml
1010
dummyvm_toml=$project_root/docs/dummyvm/Cargo.toml
1111

1212
# Pin certain deps for our MSRV
13-
cargo update -p home@0.5.11 --precise 0.5.5 # This can be removed once we move to Rust 1.81 or newer
1413
cargo update -p home@0.5.12 --precise 0.5.5 # This requires Rust edition 2024
1514

1615
# Repeat a command for all the features. Requires the command as one argument (with double quotes)

.github/workflows/micro-bm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
with:
7070
repository: mmtk/ci-perf-kit
7171
token: ${{ secrets.GITHUB_TOKEN }}
72-
ref: "0.8.4"
72+
ref: "0.8.5"
7373
path: ci-perf-kit
7474
submodules: true
7575
# Use rust-toolchain in the trunk (it doesnt matter much - if the toolchains defined in the trunk and the branch are different, we cant run anyway)

.github/workflows/perf-baseline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
with:
4343
token: ${{ secrets.CI_ACCESS_TOKEN }}
4444
repository: mmtk/ci-perf-kit
45-
ref: "0.8.4"
45+
ref: "0.8.5"
4646
path: ci-perf-kit
4747
submodules: true
4848
# setup
@@ -94,7 +94,7 @@ jobs:
9494
with:
9595
token: ${{ secrets.CI_ACCESS_TOKEN }}
9696
repository: mmtk/ci-perf-kit
97-
ref: "0.8.4"
97+
ref: "0.8.5"
9898
path: ci-perf-kit
9999
submodules: true
100100
# setup

.github/workflows/perf-compare-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
with:
113113
repository: mmtk/ci-perf-kit
114114
token: ${{ secrets.CI_ACCESS_TOKEN }}
115-
ref: "0.8.4"
115+
ref: "0.8.5"
116116
path: ci-perf-kit
117117
submodules: true
118118
# setup
@@ -223,7 +223,7 @@ jobs:
223223
with:
224224
repository: mmtk/ci-perf-kit
225225
token: ${{ secrets.CI_ACCESS_TOKEN }}
226-
ref: "0.8.4"
226+
ref: "0.8.5"
227227
path: ci-perf-kit
228228
submodules: true
229229
# setup

.github/workflows/perf-regression-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
uses: actions/checkout@v4
4646
with:
4747
repository: mmtk/ci-perf-kit
48-
ref: "0.8.4"
48+
ref: "0.8.5"
4949
path: ci-perf-kit
5050
token: ${{ secrets.CI_ACCESS_TOKEN }}
5151
submodules: true
@@ -142,7 +142,7 @@ jobs:
142142
uses: actions/checkout@v4
143143
with:
144144
repository: mmtk/ci-perf-kit
145-
ref: "0.8.4"
145+
ref: "0.8.5"
146146
path: ci-perf-kit
147147
submodules: true
148148
# download canary build
@@ -233,7 +233,7 @@ jobs:
233233
uses: actions/checkout@v4
234234
with:
235235
repository: mmtk/ci-perf-kit
236-
ref: "0.8.4"
236+
ref: "0.8.5"
237237
path: ci-perf-kit
238238
token: ${{ secrets.CI_ACCESS_TOKEN }}
239239
submodules: true

Cargo.toml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repository = "https://github.com/mmtk/mmtk-core"
1010
readme = "README.md"
1111
categories = ["memory-management"]
1212
keywords = ["gc", "garbage", "collection", "garbage-collection", "allocation"]
13-
rust-version = "1.74.1"
13+
rust-version = "1.84"
1414
build = "build.rs"
1515

1616
[lib]
@@ -59,24 +59,9 @@ paste = "1.0.8"
5959
rand = "0.9.0"
6060
rand_chacha = "0.9.0"
6161
criterion = "0.5"
62-
# Note: `half` v2.5.0 started to require Rust 1.81.
63-
# `criterion` transitively depends on `half` via the dependency chain:
64-
# criterion -> ciborium -> ciborium_ll -> half
65-
# The MSRV of `ciborium` v0.2.2 is declared as 1.58, and is declared to depend on `half` v2.2.
66-
# Ciborium should either bump its MSRV or select a version of `half` that satisfies its current MSRV.
67-
# We lock the version of `half` to 2.4.1 to workaround this.
68-
# TODO: When we bump MSRV to 1.84 or above, we can rely on Cargo's MSRV-aware dependency resolver and remove such workarounds.
69-
half = "=2.4.1"
7062

7163
[build-dependencies]
7264
built = { version = "0.7.7", features = ["git2"] }
73-
# Note: Some components in ICU4X started to require Rust 1.81 since some versions, such as `litemap` v0.7.5.
74-
# The `built` crate depends on ICU4X via the dependency chain:
75-
# built -> git2 -> url -> idna -> idna_adapter --(default)--------> crates from the ICU4X projects
76-
# --(alternatively)--> `unicode-rs`
77-
# But we don't need ICU4X (or even `url`) because we only use `git2` to get the Git commit hash.
78-
# We move away from ICU4X completely following the instruction in https://docs.rs/crate/idna_adapter/1.2.0
79-
idna_adapter = "=1.1.0"
8065

8166
[lints.clippy]
8267
# Allow this. Clippy suggests we should use Sft, Mmtk, rather than SFT and MMTK.
@@ -88,10 +73,9 @@ idna_adapter = "=1.1.0"
8873
# to me - considering it will break our API and all the efforts for all the developers to make the change, it may
8974
# not worth it.
9075
upper_case_acronyms = "allow"
91-
# Temporarily allow this -- 9 July 2025. Clippy suggests that we should always inline format args if possible.
92-
# We see pushbacks on this lint in Rust 1.67, and the lint was downgraded to pedantic in 1.67.1. It was upgraded
93-
# again in Rust 1.88. We temporarily disable this lint and see the reaction from the community.
94-
# If there is no pushback for this lint in a few momnths' time, we should remove the following line and migrate the codebase.
76+
# Allow this -- 9 July 2025. Clippy suggests that we should always inline format args if possible.
77+
# This lint was upgraded to 'style' in Rust 1.67, and then was downgraded to pedantic in 1.67.1.
78+
# It was upgraded again in Rust 1.88, and downgraded again in Rust 1.89. We disable this lint to avoid warnings in affected versions.
9579
# See https://github.com/mmtk/mmtk-core/issues/1334.
9680
uninlined_format_args = "allow"
9781

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.83.0
1+
1.92.0

src/policy/sft_map.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ impl SFTRefStorage {
141141
let val = self.0.load(Ordering::Acquire);
142142
// Provenance-related APIs were stabilized in Rust 1.84.
143143
// Rust 1.91 introduced the warn-by-default lint `integer_to_ptr_transmutes`.
144-
// Since our MSRV is still 1.74.1, we can't fix it until bumping MSRV.
144+
// However, pointer provenance API only works for ptr-sized intergers, and
145+
// here we are transmuting from a double-word sized integer to a fat pointer.
146+
// We still need to use transmute here.
145147
#[allow(unknown_lints)]
146148
#[allow(integer_to_ptr_transmutes)]
147149
unsafe {

src/util/alloc/allocator.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,9 @@ pub fn align_allocation_inner<VM: VMBinding>(
172172
}
173173

174174
// May require an alignment
175-
let region_isize = region.as_usize() as isize;
176175
let mask = (alignment - 1) as isize; // fromIntSignExtend
177176
let neg_off: isize = -(offset as isize); // fromIntSignExtend
178-
179-
// TODO: Consider using neg_off.wrapping_sub_unsigned(region.as_usize()), and we can remove region_isize.
180-
// This requires Rust 1.66.0+.
181-
let delta = neg_off.wrapping_sub(region_isize) & mask; // Use wrapping_sub to avoid overflow
177+
let delta = neg_off.wrapping_sub_unsigned(region.as_usize()) & mask; // Use wrapping_sub to avoid overflow
182178

183179
if fillalignmentgap && (VM::ALIGNMENT_VALUE != 0) {
184180
fill_alignment_gap::<VM>(region, region + delta);

src/util/erase_vm.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,13 @@ macro_rules! define_erased_vm_mut_ref {
1717
pub struct $new_type<'a>(usize, PhantomData<&'a ()>);
1818
impl<'a> $new_type<'a> {
1919
pub fn new<VM: VMBinding>(r: &'a mut $orig_type) -> Self {
20-
let worker_as_usize: usize = unsafe { std::mem::transmute(r) };
20+
let worker_as_usize: usize = (r as *mut $orig_type).expose_provenance();
2121
Self(worker_as_usize, PhantomData)
2222
}
2323
pub fn into_mut<VM: VMBinding>(self) -> &'a mut $orig_type {
24-
// Provenance-related APIs were stabilized in Rust 1.84.
25-
// Rust 1.91 introduced the warn-by-default lint `integer_to_ptr_transmutes`.
26-
// Since our MSRV is still 1.74.1, we can't fix it until bumping MSRV.
27-
#[allow(unknown_lints)]
28-
#[allow(integer_to_ptr_transmutes)]
2924
unsafe {
30-
std::mem::transmute(self.0)
25+
&mut *(std::ptr::with_exposed_provenance(self.0) as *const $orig_type
26+
as *mut $orig_type)
3127
}
3228
}
3329
}

0 commit comments

Comments
 (0)