From bc4a1dea416e1695cf77acd17ea743d4d802bae0 Mon Sep 17 00:00:00 2001 From: Jack Wrenn Date: Sat, 3 Jul 2021 12:18:13 -0400 Subject: Initial (incomplete) implementation of transmutability trait. This initial implementation handles transmutations between types with specified layouts, except when references are involved. Co-authored-by: Igor null --- compiler/rustc_target/src/abi/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_target/src') diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs index b35502d9ee4..0758bf7c7cb 100644 --- a/compiler/rustc_target/src/abi/mod.rs +++ b/compiler/rustc_target/src/abi/mod.rs @@ -508,6 +508,7 @@ impl fmt::Debug for Align { impl Align { pub const ONE: Align = Align { pow2: 0 }; + pub const MAX: Align = Align { pow2: 29 }; #[inline] pub fn from_bits(bits: u64) -> Result { @@ -540,7 +541,7 @@ impl Align { if bytes != 1 { return Err(not_power_of_2(align)); } - if pow2 > 29 { + if pow2 > Self::MAX.pow2 { return Err(too_large(align)); } -- cgit 1.4.1-3-g733a5