Skip to content

Commit 56adff4

Browse files
authored
Cleaning up after bumping Rust MSRV (#1442)
We start using the MSRV-aware resolver (`resolver = "3"`). We bumped dependency versions. - We removed locked dependency versions that work around broken transitive dependencies due to MSRV limitation. - We still limit some of our dependency versions (`sysinfo` and `criterion`) below the latest version because their latest versions require higher MSRV and newer Rust editions. - Note that the MSRV-aware resolver can find a compatible version only within the allowed version range. For example, if we specify `0.7.2`, it will be equivalent to `>=0.7.2,<0.8.0`. So if `0.7.4` is compatible but `0.7.5` is not, it will resolve to `0.7.4`. But if `0.7.2` is incompatible, the resolver will refuse to go below `0.7.2`, and the resolution will fail. Both `sysinfo` and `criterion` broke MSRV compatibility when bumping a minor version (since the major versions are 0, minor version signifies incompatibility), so the MSRV-aware resolver is not helping for those two specific dependencies. Removed a workaround in `ByteMapStateStorage::new` where we could use `const {}` to initialize a vector without copying.
1 parent e30d0a0 commit 56adff4

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

Cargo.toml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mmtk"
33
version = "0.31.0"
44
authors = ["The MMTk Developers <>"]
5-
edition = "2021"
5+
edition = "2021" # TODO: Switch to 2024 after bumping MSRV to 1.85
66
license = "MIT OR Apache-2.0"
77
description = "MMTk is a framework for the design and implementation of high-performance and portable memory managers."
88
homepage = "https://www.mmtk.io"
@@ -12,6 +12,17 @@ categories = ["memory-management"]
1212
keywords = ["gc", "garbage", "collection", "garbage-collection", "allocation"]
1313
rust-version = "1.84"
1414
build = "build.rs"
15+
# Use the MSRV-aware resolver which has been available since Rust 1.84.
16+
#
17+
# NOTE: The MSRV-aware resolver will only find compatible versions within the allowed version range.
18+
# For example, if we specify a dependency version as "0.7.2" or equivalently ">=0.7.2,<0.8.0",
19+
# and the version 0.7.4 is MSRV-compatible but 0.7.5 is not, then it will resolve to 0.7.4.
20+
# However, if 0.7.2 is not compatible with our MSRV,
21+
# the resolver will refuse to go below 0.7.2, and the resolution will fail.
22+
# For this reason, we still need to keep some dependency versions below the latest versions.
23+
#
24+
# TODO: Remove `resolver = "3"` after bumping Rust edition to 2024 (Rust 1.85+) because it will be the default.
25+
resolver = "3"
1526

1627
[lib]
1728
name = "mmtk"
@@ -23,7 +34,6 @@ atomic = "0.6.0"
2334
atomic_refcell = "0.1.7"
2435
atomic-traits = "0.4.0"
2536
bytemuck = { version = "1.14.0", features = ["derive", "zeroable_maybe_uninit"] }
26-
bytemuck_derive = "=1.8.1" # We can remove this dependency when we use MSRV 1.84+
2737
cfg-if = "1.0"
2838
crossbeam = "0.8.1"
2939
delegate = "0.13.2"
@@ -47,21 +57,22 @@ portable-atomic = "1.4.3"
4757
probe = "0.5"
4858
regex = "1.7.0"
4959
rustversion = "1.0"
50-
rayon-core = "=1.12.1" # We can remove this dependency when we use MSRV 1.80+
51-
spin = "0.9.5"
60+
spin = "0.10.0"
5261
static_assertions = "1.1.0"
5362
strum = "0.27.1"
5463
strum_macros = "0.27.1"
55-
sysinfo = "0.33.1"
64+
# sysinfo >=0.37.0 requires MSRV 1.88.0 and Rust edition 2024.
65+
sysinfo = "0.36.1"
5666

5767
[dev-dependencies]
5868
paste = "1.0.8"
5969
rand = "0.9.0"
6070
rand_chacha = "0.9.0"
61-
criterion = "0.5"
71+
# criterion >=0.8.0 requires MSRV 1.86.0.
72+
criterion = "0.7.0"
6273

6374
[build-dependencies]
64-
built = { version = "0.7.7", features = ["git2"] }
75+
built = { version = "0.8.0", features = ["git2"] }
6576

6677
[lints.clippy]
6778
# Allow this. Clippy suggests we should use Sft, Mmtk, rather than SFT and MMTK.

benches/mock_bench/sft.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use criterion::black_box;
1+
use std::hint::black_box;
2+
23
use criterion::Criterion;
34

45
use mmtk::memory_manager;

src/util/heap/layout/mmapper/csm/byte_map_storage.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,9 @@ impl MapStateStorage for ByteMapStateStorage {
107107

108108
impl ByteMapStateStorage {
109109
pub fn new() -> Self {
110-
// Because AtomicU8 does not implement Copy, it is a compilation error to usen the
111-
// expression `[Atomic::new(MapState::Unmapped); MMAP_NUM_CHUNKS]` because that involves
112-
// copying. We must define a constant for it.
113-
//
114-
// TODO: Use the inline const expression `const { Atomic::new(MapState::Unmapped) }` after
115-
// we bump MSRV to 1.79.
116-
117-
// If we declare a const Atomic, Clippy will warn about const items being interior mutable.
118-
// Using inline const expression will eliminate this warning, but that is experimental until
119-
// 1.79. Fix it after we bump MSRV.
120-
#[allow(clippy::declare_interior_mutable_const)]
121-
const INITIAL_ENTRY: Atomic<MapState> = Atomic::new(MapState::Unmapped);
122-
123110
ByteMapStateStorage {
124111
lock: Mutex::new(()),
125-
mapped: [INITIAL_ENTRY; MMAP_NUM_CHUNKS],
112+
mapped: [const { Atomic::new(MapState::Unmapped) }; MMAP_NUM_CHUNKS],
126113
}
127114
}
128115
}

0 commit comments

Comments
 (0)