|
| 1 | +// compile-flags:-g |
| 2 | + |
| 3 | +// gdb-command: run |
| 4 | + |
| 5 | +// gdb-command: print slice |
| 6 | +// gdb-check: $1 = &[i32](size=3) = {0, 1, 2} |
| 7 | + |
| 8 | +// gdb-command: print mut_slice |
| 9 | +// gdb-check: $2 = &mut [i32](size=4) = {2, 3, 5, 7} |
| 10 | + |
| 11 | +// gdb-command: print str_slice |
| 12 | +// gdb-check: $3 = "string slice" |
| 13 | + |
| 14 | +// gdb-command: print mut_str_slice |
| 15 | +// gdb-check: $4 = "mutable string slice" |
| 16 | + |
| 17 | +// lldb-command: run |
| 18 | + |
| 19 | +// lldb-command: print slice |
| 20 | +// lldb-check: (&[i32]) $0 = size=3 { [0] = 0 [1] = 1 [2] = 2 } |
| 21 | + |
| 22 | +// lldb-command: print mut_slice |
| 23 | +// lldb-check: (&mut [i32]) $1 = size=4 { [0] = 2 [1] = 3 [2] = 5 [3] = 7 } |
| 24 | + |
| 25 | +// lldb-command: print str_slice |
| 26 | +// lldb-check: (&str) $2 = "string slice" { data_ptr = [...] length = 12 } |
| 27 | + |
| 28 | +// lldb-command: print mut_str_slice |
| 29 | +// lldb-check: (&mut str) $3 = "mutable string slice" { data_ptr = [...] length = 20 } |
| 30 | + |
| 31 | +fn b() {} |
| 32 | + |
| 33 | +fn main() { |
| 34 | + |
| 35 | + let slice: &[i32] = &[0, 1, 2]; |
| 36 | + let mut_slice: &mut [i32] = &mut [2, 3, 5, 7]; |
| 37 | + |
| 38 | + let str_slice: &str = "string slice"; |
| 39 | + let mut mut_str_slice_buffer = String::from("mutable string slice"); |
| 40 | + let mut_str_slice: &mut str = mut_str_slice_buffer.as_mut_str(); |
| 41 | + |
| 42 | + b(); // #break |
| 43 | +} |
0 commit comments