Skip to content

Commit e8a1925

Browse files
committed
safe transmute: use AtomicU32 State ids to appease mips
...instead of `AtomicU64`, which is unavailable. ref: #92268 (comment)
1 parent aee5f31 commit e8a1925

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

compiler/rustc_transmute/src/layout/dfa.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::{nfa, Byte, Nfa, Ref};
22
use crate::Map;
33
use std::fmt;
4-
use std::sync::atomic::{AtomicU64, Ordering};
4+
use std::sync::atomic::{AtomicU32, Ordering};
55

66
#[derive(PartialEq, Clone, Debug)]
77
pub(crate) struct Dfa<R>
@@ -49,7 +49,7 @@ where
4949

5050
/// The states in a `Nfa` represent byte offsets.
5151
#[derive(Hash, Eq, PartialEq, PartialOrd, Ord, Copy, Clone)]
52-
pub(crate) struct State(u64);
52+
pub(crate) struct State(u32);
5353

5454
#[derive(Hash, Eq, PartialEq, Clone, Copy)]
5555
pub(crate) enum Transition<R>
@@ -166,7 +166,7 @@ where
166166

167167
impl State {
168168
pub(crate) fn new() -> Self {
169-
static COUNTER: AtomicU64 = AtomicU64::new(0);
169+
static COUNTER: AtomicU32 = AtomicU32::new(0);
170170
Self(COUNTER.fetch_add(1, Ordering::SeqCst))
171171
}
172172
}

compiler/rustc_transmute/src/layout/nfa.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::{Byte, Ref, Tree, Uninhabited};
22
use crate::{Map, Set};
33
use std::fmt;
4-
use std::sync::atomic::{AtomicU64, Ordering};
4+
use std::sync::atomic::{AtomicU32, Ordering};
55

66
/// A non-deterministic finite automaton (NFA) that represents the layout of a type.
77
/// The transmutability of two given types is computed by comparing their `Nfa`s.
@@ -17,7 +17,7 @@ where
1717

1818
/// The states in a `Nfa` represent byte offsets.
1919
#[derive(Hash, Eq, PartialEq, PartialOrd, Ord, Copy, Clone)]
20-
pub(crate) struct State(u64);
20+
pub(crate) struct State(u32);
2121

2222
/// The transitions between states in a `Nfa` reflect bit validity.
2323
#[derive(Hash, Eq, PartialEq, Clone, Copy)]
@@ -173,7 +173,7 @@ where
173173

174174
impl State {
175175
pub(crate) fn new() -> Self {
176-
static COUNTER: AtomicU64 = AtomicU64::new(0);
176+
static COUNTER: AtomicU32 = AtomicU32::new(0);
177177
Self(COUNTER.fetch_add(1, Ordering::SeqCst))
178178
}
179179
}

0 commit comments

Comments
 (0)