diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2025-06-04 14:02:09 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2025-06-08 16:41:48 -0700 |
| commit | ec13ae6475275d82ec48e2ae32e27eaecdfa19cd (patch) | |
| tree | 416445471fe254d546fb62cf96c130df34118751 | |
| parent | 2e1965831526407bada7abec631d7b7e9f6cbc7d (diff) | |
| download | rust-ec13ae6475275d82ec48e2ae32e27eaecdfa19cd.tar.gz rust-ec13ae6475275d82ec48e2ae32e27eaecdfa19cd.zip | |
compiler: add Deref to AbiAlign to ease transition
We will want to remove many cases of `.abi`, including `.abi.thing`, so this may simplify future PRs and certainly doesn't hurt. We omit DerefMut because mutation is much rarer and localized.
| -rw-r--r-- | compiler/rustc_abi/src/lib.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 29e36c021ed..4268e68b2e4 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -43,7 +43,7 @@ use std::fmt; #[cfg(feature = "nightly")] use std::iter::Step; use std::num::{NonZeroUsize, ParseIntError}; -use std::ops::{Add, AddAssign, Mul, RangeInclusive, Sub}; +use std::ops::{Add, AddAssign, Deref, Mul, RangeInclusive, Sub}; use std::str::FromStr; use bitflags::bitflags; @@ -884,6 +884,14 @@ impl AbiAlign { } } +impl Deref for AbiAlign { + type Target = Align; + + fn deref(&self) -> &Self::Target { + &self.abi + } +} + /// Integers, also used for enum discriminants. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] #[cfg_attr( |
