From 1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Tue, 8 Sep 2020 21:39:13 +0200 Subject: Use `T::BITS` instead of `size_of:: * 8`. --- compiler/rustc_data_structures/src/lib.rs | 1 + compiler/rustc_data_structures/src/tagged_ptr/copy.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_data_structures/src') 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::()) - 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 -- cgit 1.4.1-3-g733a5