diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2020-09-08 21:39:13 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2020-09-19 06:54:42 +0200 |
| commit | 1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102 (patch) | |
| tree | 402ea425d8883c2c501f563220fddf001d0f91c2 /compiler/rustc_data_structures/src | |
| parent | 5c30a16fa03efaf87241b363f4323743746c12b0 (diff) | |
| download | rust-1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102.tar.gz rust-1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102.zip | |
Use `T::BITS` instead of `size_of::<T> * 8`.
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/lib.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/tagged_ptr/copy.rs | 2 |
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 |
