]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/fixed-sized-array.rs
Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
[rust.git] / tests / debuginfo / fixed-sized-array.rs
1 // Testing the display of fixed sized arrays in cdb.
2
3 // cdb-only
4 // min-cdb-version: 10.0.18317.1001
5 // compile-flags:-g
6
7 // === CDB TESTS ==================================================================================
8
9 // cdb-command: g
10
11 // cdb-command: dx xs,d
12 // cdb-check:xs,d             [Type: int [5]]
13 // cdb-check:    [0]              : 1 [Type: int]
14 // cdb-check:    [1]              : 2 [Type: int]
15 // cdb-check:    [2]              : 3 [Type: int]
16 // cdb-check:    [3]              : 4 [Type: int]
17 // cdb-check:    [4]              : 5 [Type: int]
18
19 // cdb-command: dx ys,d
20 // cdb-check:ys,d             [Type: int [3]]
21 // cdb-check:    [0]              : 0 [Type: int]
22 // cdb-check:    [1]              : 0 [Type: int]
23 // cdb-check:    [2]              : 0 [Type: int]
24
25 fn main() {
26     // Fixed-size array (type signature is superfluous)
27     let xs: [i32; 5] = [1, 2, 3, 4, 5];
28
29     // All elements can be initialized to the same value
30     let ys: [i32; 3] = [0; 3];
31
32     // Indexing starts at 0
33     println!("first element of the array: {}", xs[0]);
34     println!("second element of the array: {}", xs[1]);
35
36     zzz(); // #break
37 }
38
39 fn zzz() { () }