about summary refs log tree commit diff
path: root/compiler/rustc_data_structures
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2020-09-08 21:39:13 +0200
committerMara Bos <m-ou.se@m-ou.se>2020-09-19 06:54:42 +0200
commit1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102 (patch)
tree402ea425d8883c2c501f563220fddf001d0f91c2 /compiler/rustc_data_structures
parent5c30a16fa03efaf87241b363f4323743746c12b0 (diff)
downloadrust-1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102.tar.gz
rust-1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102.zip
Use `T::BITS` instead of `size_of::<T> * 8`.
Diffstat (limited to 'compiler/rustc_data_structures')
-rw-r--r--compiler/rustc_data_structures/src/lib.rs1
-rw-r--r--compiler/rustc_data_structures/src/tagged_ptr/copy.rs2
2 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs
index 88c160e93b6..06718cc9803 100644
--- a/compiler/rustc_data_structures/src/lib.rs
+++ b/compiler/rustc_data_structures/src/lib.rs
@@ -14,6 +14,7 @@
 #![feature(generators)]
 #![feature(generator_trait)]
 #![feature(fn_traits)]
+#![feature(int_bits_const)]
 #![feature(min_specialization)]
 #![feature(optin_builtin_traits)]
 #![feature(nll)]
diff --git a/compiler/rustc_data_structures/src/tagged_ptr/copy.rs b/compiler/rustc_data_structures/src/tagged_ptr/copy.rs
index d39d146db31..d63bcdb3c2b 100644
--- a/compiler/rustc_data_structures/src/tagged_ptr/copy.rs
+++ b/compiler/rustc_data_structures/src/tagged_ptr/copy.rs
@@ -48,7 +48,7 @@ where
     P: Pointer,
     T: Tag,
 {
-    const TAG_BIT_SHIFT: usize = (8 * std::mem::size_of::<usize>()) - T::BITS;
+    const TAG_BIT_SHIFT: usize = usize::BITS as usize - T::BITS;
     const ASSERTION: () = {
         assert!(T::BITS <= P::BITS);
         // Used for the transmute_copy's below