]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/nil-enum.rs
94377421c0b0c9927a039b26970371581d959315
[rust.git] / src / test / debuginfo / nil-enum.rs
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 // LLDB can't handle zero-sized values
12 // ignore-lldb
13
14
15 // compile-flags:-g
16 // gdb-command:run
17
18 // gdb-command:print first
19 // gdbg-check:$1 = {<No data fields>}
20 // gdbr-check:$1 = <error reading variable>
21
22 // gdb-command:print second
23 // gdbg-check:$2 = {<No data fields>}
24 // gdbr-check:$2 = <error reading variable>
25
26 #![allow(unused_variables)]
27 #![feature(omit_gdb_pretty_printer_section)]
28 #![omit_gdb_pretty_printer_section]
29
30 enum ANilEnum {}
31 enum AnotherNilEnum {}
32
33 // This test relies on gdbg printing the string "{<No data fields>}" for empty
34 // structs (which may change some time)
35 // The error from gdbr is expected since nil enums are not supposed to exist.
36 fn main() {
37     unsafe {
38         let first: ANilEnum = ::std::mem::zeroed();
39         let second: AnotherNilEnum = ::std::mem::zeroed();
40
41         zzz(); // #break
42     }
43 }
44
45 fn zzz() {()}