about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJack Wrenn <jack@wrenn.fyi>2022-07-28 13:47:11 +0000
committerJack Wrenn <jack@wrenn.fyi>2022-07-28 13:47:11 +0000
commite8a1925b64197576b83dfba8b75a80ca705edbdd (patch)
treea0ccc770c06db872efc722a4b02fc36878ab6175
parentaee5f31c682664bd2e42be6b3fefdd3dd8a390e8 (diff)
downloadrust-e8a1925b64197576b83dfba8b75a80ca705edbdd.tar.gz
rust-e8a1925b64197576b83dfba8b75a80ca705edbdd.zip
safe transmute: use `AtomicU32` `State` ids to appease mips
...instead of `AtomicU64`, which is unavailable.

ref: https://github.com/rust-lang/rust/pull/92268#issuecomment-1197797990
-rw-r--r--compiler/rustc_transmute/src/layout/dfa.rs6
-rw-r--r--compiler/rustc_transmute/src/layout/nfa.rs6
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_transmute/src/layout/dfa.rs b/compiler/rustc_transmute/src/layout/dfa.rs
index 09a60cf6a62..b60ea6e7a24 100644
--- a/compiler/rustc_transmute/src/layout/dfa.rs
+++ b/compiler/rustc_transmute/src/layout/dfa.rs
@@ -1,7 +1,7 @@
 use super::{nfa, Byte, Nfa, Ref};
 use crate::Map;
 use std::fmt;
-use std::sync::atomic::{AtomicU64, Ordering};
+use std::sync::atomic::{AtomicU32, Ordering};
 
 #[derive(PartialEq, Clone, Debug)]
 pub(crate) struct Dfa<R>
@@ -49,7 +49,7 @@ where
 
 /// The states in a `Nfa` represent byte offsets.
 #[derive(Hash, Eq, PartialEq, PartialOrd, Ord, Copy, Clone)]
-pub(crate) struct State(u64);
+pub(crate) struct State(u32);
 
 #[derive(Hash, Eq, PartialEq, Clone, Copy)]
 pub(crate) enum Transition<R>
@@ -166,7 +166,7 @@ where
 
 impl State {
     pub(crate) fn new() -> Self {
-        static COUNTER: AtomicU64 = AtomicU64::new(0);
+        static COUNTER: AtomicU32 = AtomicU32::new(0);
         Self(COUNTER.fetch_add(1, Ordering::SeqCst))
     }
 }
diff --git a/compiler/rustc_transmute/src/layout/nfa.rs b/compiler/rustc_transmute/src/layout/nfa.rs
index 3b2548e7aed..f25e3c1fd8a 100644
--- a/compiler/rustc_transmute/src/layout/nfa.rs
+++ b/compiler/rustc_transmute/src/layout/nfa.rs
@@ -1,7 +1,7 @@
 use super::{Byte, Ref, Tree, Uninhabited};
 use crate::{Map, Set};
 use std::fmt;
-use std::sync::atomic::{AtomicU64, Ordering};
+use std::sync::atomic::{AtomicU32, Ordering};
 
 /// A non-deterministic finite automaton (NFA) that represents the layout of a type.
 /// The transmutability of two given types is computed by comparing their `Nfa`s.
@@ -17,7 +17,7 @@ where
 
 /// The states in a `Nfa` represent byte offsets.
 #[derive(Hash, Eq, PartialEq, PartialOrd, Ord, Copy, Clone)]
-pub(crate) struct State(u64);
+pub(crate) struct State(u32);
 
 /// The transitions between states in a `Nfa` reflect bit validity.
 #[derive(Hash, Eq, PartialEq, Clone, Copy)]
@@ -173,7 +173,7 @@ where
 
 impl State {
     pub(crate) fn new() -> Self {
-        static COUNTER: AtomicU64 = AtomicU64::new(0);
+        static COUNTER: AtomicU32 = AtomicU32::new(0);
         Self(COUNTER.fetch_add(1, Ordering::SeqCst))
     }
 }