|
1 | | -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT |
2 | | -// file at the top-level directory of this distribution and at |
3 | | -// http://rust-lang.org/COPYRIGHT. |
4 | | -// |
5 | | -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
6 | | -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
7 | | -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
8 | | -// option. This file may not be copied, modified, or distributed |
9 | | -// except according to those terms. |
10 | | - |
11 | | -// NOTE Instantiating an empty enum is UB. This test may break in the future. |
12 | | - |
13 | | -// LLDB can't handle zero-sized values |
| 1 | +// LLDB can't handle zero-sized values. |
14 | 2 | // ignore-lldb |
15 | 3 |
|
16 | | - |
17 | | -// Require LLVM with DW_TAG_variant_part and a gdb that can read it. |
18 | | -// gdb 8.2.0 crashes on this test case, see |
19 | | -// https://sourceware.org/bugzilla/show_bug.cgi?id=23626 |
20 | | -// This will be fixed in the next release, which will be >= 8.2.1. |
21 | | -// min-system-llvm-version: 7.0 |
22 | | -// min-gdb-version: 8.2.1 |
23 | | - |
24 | 4 | // compile-flags:-g |
25 | 5 | // gdb-command:run |
26 | 6 |
|
27 | | -// gdb-command:print first |
28 | | -// gdbr-check:$1 = nil_enum::ANilEnum {<No data fields>} |
29 | | - |
30 | | -// gdb-command:print second |
31 | | -// gdbr-check:$2 = nil_enum::AnotherNilEnum {<No data fields>} |
| 7 | +// gdb-command:print *first |
| 8 | +// gdbg-check:$1 = {<No data fields>} |
| 9 | +// gdbr-check:$1 = <error reading variable> |
32 | 10 |
|
33 | 11 | #![allow(unused_variables)] |
34 | 12 | #![feature(omit_gdb_pretty_printer_section)] |
35 | 13 | #![feature(maybe_uninit)] |
36 | 14 | #![omit_gdb_pretty_printer_section] |
37 | 15 |
|
38 | | -use std::mem::MaybeUninit; |
39 | | - |
40 | | -enum ANilEnum {} |
41 | | -enum AnotherNilEnum {} |
| 16 | +enum Void {} |
42 | 17 |
|
43 | | -// This test relies on gdbg printing the string "{<No data fields>}" for empty |
44 | | -// structs (which may change some time) |
45 | | -// The error from gdbr is expected since nil enums are not supposed to exist. |
46 | 18 | fn main() { |
47 | | - unsafe { |
48 | | - let first: ANilEnum = MaybeUninit::uninitialized().into_inner(); |
49 | | - let second: AnotherNilEnum = MaybeUninit::uninitialized().into_inner(); |
| 19 | + let first: *const Void = 1 as *const _; |
50 | 20 |
|
51 | | - zzz(); // #break |
52 | | - } |
| 21 | + zzz(); // #break |
53 | 22 | } |
54 | 23 |
|
55 | | -fn zzz() {()} |
| 24 | +fn zzz() {} |
0 commit comments