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.
This commit is contained in:
parent
2e19658315
commit
ec13ae6475
1 changed files with 9 additions and 1 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue