Skip to content

Commit

Permalink
Rollup merge of #102862 - scottmcm:more-alignment-traits, r=thomcc
Browse files Browse the repository at this point in the history
From<Alignment> for usize & NonZeroUsize

Since you mentioned these two in rust-lang/rust#102072 (comment),
r? ``@thomcc``

Tracking Issue: rust-lang/rust#102070
  • Loading branch information
JohnTitor authored Oct 10, 2022
2 parents e6280cd + d7c692a commit 41e51f6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/src/ptr/alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,22 @@ impl TryFrom<usize> for Alignment {
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl From<Alignment> for NonZeroUsize {
#[inline]
fn from(align: Alignment) -> NonZeroUsize {
align.as_nonzero()
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl From<Alignment> for usize {
#[inline]
fn from(align: Alignment) -> usize {
align.as_usize()
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl cmp::Ord for Alignment {
#[inline]
Expand Down

0 comments on commit 41e51f6

Please sign in to comment.