Skip to content

Commit ec13ae6

Browse files
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.
1 parent 2e19658 commit ec13ae6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

compiler/rustc_abi/src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use std::fmt;
4343
#[cfg(feature = "nightly")]
4444
use std::iter::Step;
4545
use std::num::{NonZeroUsize, ParseIntError};
46-
use std::ops::{Add, AddAssign, Mul, RangeInclusive, Sub};
46+
use std::ops::{Add, AddAssign, Deref, Mul, RangeInclusive, Sub};
4747
use std::str::FromStr;
4848

4949
use bitflags::bitflags;
@@ -884,6 +884,14 @@ impl AbiAlign {
884884
}
885885
}
886886

887+
impl Deref for AbiAlign {
888+
type Target = Align;
889+
890+
fn deref(&self) -> &Self::Target {
891+
&self.abi
892+
}
893+
}
894+
887895
/// Integers, also used for enum discriminants.
888896
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
889897
#[cfg_attr(

0 commit comments

Comments
 (0)