]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/basic-types-globals.rs
Rollup merge of #107446 - clubby789:rustc-parse-diag-migrate, r=compiler-errors
[rust.git] / tests / debuginfo / basic-types-globals.rs
1 // Caveat - gdb doesn't know about UTF-32 character encoding and will print a
2 // rust char as only its numerical value.
3
4 // min-lldb-version: 310
5 // min-gdb-version: 8.0
6
7 // revisions: lto no-lto
8
9 // compile-flags:-g
10
11 // [lto] compile-flags:-C lto
12 // [lto] no-prefer-dynamic
13
14 // gdb-command:run
15 // gdbg-command:print 'basic_types_globals::B'
16 // gdbr-command:print B
17 // gdb-check:$1 = false
18 // gdbg-command:print 'basic_types_globals::I'
19 // gdbr-command:print I
20 // gdb-check:$2 = -1
21 // gdbg-command:print 'basic_types_globals::C'
22 // gdbr-command:print/d C
23 // gdbg-check:$3 = 97
24 // gdbr-check:$3 = 97
25 // gdbg-command:print/d 'basic_types_globals::I8'
26 // gdbr-command:print I8
27 // gdb-check:$4 = 68
28 // gdbg-command:print 'basic_types_globals::I16'
29 // gdbr-command:print I16
30 // gdb-check:$5 = -16
31 // gdbg-command:print 'basic_types_globals::I32'
32 // gdbr-command:print I32
33 // gdb-check:$6 = -32
34 // gdbg-command:print 'basic_types_globals::I64'
35 // gdbr-command:print I64
36 // gdb-check:$7 = -64
37 // gdbg-command:print 'basic_types_globals::U'
38 // gdbr-command:print U
39 // gdb-check:$8 = 1
40 // gdbg-command:print/d 'basic_types_globals::U8'
41 // gdbr-command:print U8
42 // gdb-check:$9 = 100
43 // gdbg-command:print 'basic_types_globals::U16'
44 // gdbr-command:print U16
45 // gdb-check:$10 = 16
46 // gdbg-command:print 'basic_types_globals::U32'
47 // gdbr-command:print U32
48 // gdb-check:$11 = 32
49 // gdbg-command:print 'basic_types_globals::U64'
50 // gdbr-command:print U64
51 // gdb-check:$12 = 64
52 // gdbg-command:print 'basic_types_globals::F32'
53 // gdbr-command:print F32
54 // gdb-check:$13 = 2.5
55 // gdbg-command:print 'basic_types_globals::F64'
56 // gdbr-command:print F64
57 // gdb-check:$14 = 3.5
58 // gdb-command:continue
59
60 #![allow(unused_variables)]
61 #![feature(omit_gdb_pretty_printer_section)]
62 #![omit_gdb_pretty_printer_section]
63
64 // N.B. These are `mut` only so they don't constant fold away.
65 static mut B: bool = false;
66 static mut I: isize = -1;
67 static mut C: char = 'a';
68 static mut I8: i8 = 68;
69 static mut I16: i16 = -16;
70 static mut I32: i32 = -32;
71 static mut I64: i64 = -64;
72 static mut U: usize = 1;
73 static mut U8: u8 = 100;
74 static mut U16: u16 = 16;
75 static mut U32: u32 = 32;
76 static mut U64: u64 = 64;
77 static mut F32: f32 = 2.5;
78 static mut F64: f64 = 3.5;
79
80 fn main() {
81     _zzz(); // #break
82
83     let a = unsafe { (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64) };
84 }
85
86 fn _zzz() {()}