Skip to content

Commit 63c007e

Browse files
authored
Fix Clippy 1.91 warnings. (#1413)
We now implement the `Default` trait for `enum Pause` using annotation. We silenced the `integer_to_ptr_transmutes` lint (newly introduced in Rust 1.91) in two places because the proper fix requires Rust 1.84, while our MSRV is still 1.74.1.
1 parent ba73217 commit 63c007e

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

src/plan/concurrent/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ use bytemuck::NoUninit;
1010
// TODO: This is probably not be general enough for all the concurrent plans.
1111
// TODO: We could consider moving this to specific plans later.
1212
#[repr(u8)]
13-
#[derive(Debug, PartialEq, Eq, Copy, Clone, NoUninit)]
13+
#[derive(Debug, PartialEq, Eq, Copy, Clone, NoUninit, Default)]
1414
pub enum Pause {
1515
/// A whole GC (including root scanning, closure, releasing, etc.) happening in a single pause.
1616
///
1717
/// Don't be confused with "full-heap" GC in generational collectors. `Pause::Full` can also
1818
/// refer to a nursery GC that happens in a single pause.
19+
#[default]
1920
Full = 1,
2021
/// The initial pause before concurrent marking.
2122
InitialMark,
@@ -26,9 +27,3 @@ pub enum Pause {
2627
unsafe impl bytemuck::ZeroableInOption for Pause {}
2728

2829
unsafe impl bytemuck::PodInOption for Pause {}
29-
30-
impl Default for Pause {
31-
fn default() -> Self {
32-
Self::Full
33-
}
34-
}

src/policy/sft_map.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,14 @@ impl SFTRefStorage {
139139
// Load with the acquire ordering.
140140
pub fn load(&self) -> &dyn SFT {
141141
let val = self.0.load(Ordering::Acquire);
142-
unsafe { std::mem::transmute(val) }
142+
// Provenance-related APIs were stabilized in Rust 1.84.
143+
// 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.
145+
#[allow(unknown_lints)]
146+
#[allow(integer_to_ptr_transmutes)]
147+
unsafe {
148+
std::mem::transmute(val)
149+
}
143150
}
144151

145152
// Store a raw SFT pointer with the release ordering.

src/util/erase_vm.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ macro_rules! define_erased_vm_mut_ref {
2121
Self(worker_as_usize, PhantomData)
2222
}
2323
pub fn into_mut<VM: VMBinding>(self) -> &'a mut $orig_type {
24-
unsafe { std::mem::transmute(self.0) }
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)]
29+
unsafe {
30+
std::mem::transmute(self.0)
31+
}
2532
}
2633
}
2734
};

0 commit comments

Comments
 (0)