about summary refs log tree commit diff
path: root/compiler/rustc_abi
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2025-06-04 14:02:09 -0700
committerJubilee Young <workingjubilee@gmail.com>2025-06-08 16:41:48 -0700
commitec13ae6475275d82ec48e2ae32e27eaecdfa19cd (patch)
tree416445471fe254d546fb62cf96c130df34118751 /compiler/rustc_abi
parent2e1965831526407bada7abec631d7b7e9f6cbc7d (diff)
downloadrust-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.
Diffstat (limited to 'compiler/rustc_abi')
-rw-r--r--compiler/rustc_abi/src/lib.rs10
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(