mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
From<Alignment> for usize & NonZeroUsize
This commit is contained in:
parent
81f3919303
commit
0718aeceb3
@ -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]
|
||||
|
@ -16,7 +16,7 @@ LL | Ok(Err(123_i32)?)
|
||||
<f64 as From<i16>>
|
||||
<f64 as From<i32>>
|
||||
<f64 as From<i8>>
|
||||
and 67 others
|
||||
and 68 others
|
||||
= note: required for `Result<u64, u8>` to implement `FromResidual<Result<Infallible, i32>>`
|
||||
|
||||
error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result`
|
||||
|
Loading…
Reference in New Issue
Block a user