mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
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:
@@ -43,7 +43,7 @@
|
||||
#[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 @@ pub fn max(self, other: AbiAlign) -> 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(
|
||||
|
||||
Reference in New Issue
Block a user