diff options
| author | Jack Wrenn <jack@wrenn.fyi> | 2021-07-03 12:18:13 -0400 |
|---|---|---|
| committer | Jack Wrenn <jack@wrenn.fyi> | 2022-07-27 17:33:56 +0000 |
| commit | bc4a1dea416e1695cf77acd17ea743d4d802bae0 (patch) | |
| tree | f53690a1600de8fa7923dd3da10daf919978c492 /compiler/rustc_target/src | |
| parent | 2a220937c283803bfd5d1155e4a81e6287089504 (diff) | |
| download | rust-bc4a1dea416e1695cf77acd17ea743d4d802bae0.tar.gz rust-bc4a1dea416e1695cf77acd17ea743d4d802bae0.zip | |
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 <m1el.2027@gmail.com>
Diffstat (limited to 'compiler/rustc_target/src')
| -rw-r--r-- | compiler/rustc_target/src/abi/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
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<Align, String> { @@ -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)); } |
