Skip to content

Commit

Permalink
make the nil-enum test work again
Browse files Browse the repository at this point in the history
  • Loading branch information
japaric authored and RalfJung committed Sep 30, 2018
1 parent fba4e29 commit a5dfbdb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/test/debuginfo/nil-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// NOTE Instantiating an empty enum is UB. This test may break in the future.

// LLDB can't handle zero-sized values
// ignore-lldb

Expand All @@ -25,8 +27,11 @@

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![feature(maybe_uninit)]
#![omit_gdb_pretty_printer_section]

use std::mem::MaybeUninit;

enum ANilEnum {}
enum AnotherNilEnum {}

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

zzz(); // #break
}
Expand Down

0 comments on commit a5dfbdb

Please sign in to comment.