]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/pretty-slices.rs
Rollup merge of #107807 - GuillaumeGomez:fix-small-debug-typo, r=notriddle
[rust.git] / tests / debuginfo / pretty-slices.rs
1 // ignore-android: FIXME(#10381)
2 // ignore-windows
3 // compile-flags:-g
4
5 // gdb-command: run
6
7 // gdb-command: print slice
8 // gdbg-check: $1 = struct &[i32](size=3) = {0, 1, 2}
9 // gdbr-check: $1 = &[i32](size=3) = {0, 1, 2}
10
11 // gdb-command: print mut_slice
12 // gdbg-check: $2 = struct &mut [i32](size=4) = {2, 3, 5, 7}
13 // gdbr-check: $2 = &mut [i32](size=4) = {2, 3, 5, 7}
14
15 // gdb-command: print str_slice
16 // gdb-check: $3 = "string slice"
17
18 // gdb-command: print mut_str_slice
19 // gdb-check: $4 = "mutable string slice"
20
21 // lldb-command: run
22
23 // lldb-command: print slice
24 // lldb-check: (&[i32]) $0 = size=3 { [0] = 0 [1] = 1 [2] = 2 }
25
26 // lldb-command: print mut_slice
27 // lldb-check: (&mut [i32]) $1 = size=4 { [0] = 2 [1] = 3 [2] = 5 [3] = 7 }
28
29 // lldb-command: print str_slice
30 // lldb-check: (&str) $2 = "string slice" { data_ptr = [...] length = 12 }
31
32 // lldb-command: print mut_str_slice
33 // lldb-check: (&mut str) $3 = "mutable string slice" { data_ptr = [...] length = 20 }
34
35 fn b() {}
36
37 fn main() {
38     let slice: &[i32] = &[0, 1, 2];
39     let mut_slice: &mut [i32] = &mut [2, 3, 5, 7];
40
41     let str_slice: &str = "string slice";
42     let mut mut_str_slice_buffer = String::from("mutable string slice");
43     let mut_str_slice: &mut str = mut_str_slice_buffer.as_mut_str();
44
45     b(); // #break
46 }