Skip to content

Commit 2327942

Browse files
committed
make the nil-enum test work again
1 parent e6d0fb7 commit 2327942

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/test/debuginfo/nil-enum.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// NOTE Instantiating an empty enum is UB. This test may break in the future.
12+
1113
// LLDB can't handle zero-sized values
1214
// ignore-lldb
1315

@@ -25,8 +27,11 @@
2527

2628
#![allow(unused_variables)]
2729
#![feature(omit_gdb_pretty_printer_section)]
30+
#![feature(maybe_uninit)]
2831
#![omit_gdb_pretty_printer_section]
2932

33+
use std::mem::MaybeUninit;
34+
3035
enum ANilEnum {}
3136
enum AnotherNilEnum {}
3237

@@ -35,8 +40,8 @@ enum AnotherNilEnum {}
3540
// The error from gdbr is expected since nil enums are not supposed to exist.
3641
fn main() {
3742
unsafe {
38-
let first: ANilEnum = ::std::mem::zeroed();
39-
let second: AnotherNilEnum = ::std::mem::zeroed();
43+
let first: ANilEnum = MaybeUninit::uninitialized().into_inner();
44+
let second: AnotherNilEnum = MaybeUninit::uninitialized().into_inner();
4045

4146
zzz(); // #break
4247
}

0 commit comments

Comments
 (0)