mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 23:12:02 +00:00
Fix unwrapping usize issue with transparent MaybeUnit array wrapper
This commit is contained in:
parent
7e92607f5a
commit
c2b663c666
@ -549,8 +549,8 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
|
||||
}
|
||||
}
|
||||
|
||||
let count = count.assert_usize(tcx).ok_or(LayoutError::Unknown(ty))?;
|
||||
let element = self.layout_of(element)?;
|
||||
let count = count.unwrap_usize(tcx);
|
||||
let size = element.size.checked_mul(count, dl)
|
||||
.ok_or(LayoutError::SizeOverflow(ty))?;
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
// run-pass
|
||||
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
|
||||
use std::mem::MaybeUninit;
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct MaybeUninitWrapper<const N: usize>(MaybeUninit<[u64; N]>);
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,6 @@
|
||||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
--> $DIR/transparent-maybeunit-array-wrapper.rs:3:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user