Rollup merge of #101180 - SUPERCILEX:const-maybeuninit, r=TaKO8Ki

Add another MaybeUninit array test with const

This is another possible syntax and I just want to be absolutely sure it behaves correctly.
This commit is contained in:
Dylan DPC 2022-08-30 11:26:55 +05:30 committed by GitHub
commit ec95a92904
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
// compile-flags: -O // compile-flags: -O
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(inline_const)]
use std::mem::MaybeUninit; use std::mem::MaybeUninit;
@ -9,3 +10,8 @@ pub fn maybe_uninit() -> [MaybeUninit<u8>; 3000] {
// CHECK-NOT: memset // CHECK-NOT: memset
[MaybeUninit::uninit(); 3000] [MaybeUninit::uninit(); 3000]
} }
pub fn maybe_uninit_const<T>() -> [MaybeUninit<T>; 8192] {
// CHECK-NOT: memset
[const { MaybeUninit::uninit() }; 8192]
}