fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
1.9 KiB62 linesraw
1error[E0435]: attempt to use a non-constant value in a constant
2  --> $DIR/repeat_count.rs:5:17
3   |
4LL |     let a = [0; n];
5   |                 ^ non-constant value
6
7error[E0308]: mismatched types
8  --> $DIR/repeat_count.rs:7:17
9   |
10LL |     let b = [0; ()];
11   |                 ^^ expected `usize`, found `()`
12
13error[E0308]: mismatched types
14  --> $DIR/repeat_count.rs:10:17
15   |
16LL |     let c = [0; true];
17   |                 ^^^^ expected `usize`, found `bool`
18
19error[E0308]: mismatched types
20  --> $DIR/repeat_count.rs:13:17
21   |
22LL |     let d = [0; 0.5];
23   |                 ^^^ expected `usize`, found floating-point number
24
25error[E0308]: mismatched types
26  --> $DIR/repeat_count.rs:16:17
27   |
28LL |     let e = [0; "foo"];
29   |                 ^^^^^ expected `usize`, found `&str`
30
31error[E0308]: mismatched types
32  --> $DIR/repeat_count.rs:28:17
33   |
34LL |     let g = [0; G { g: () }];
35   |                 ^^^^^^^^^^^ expected `usize`, found struct `main::G`
36
37error[E0308]: mismatched types
38  --> $DIR/repeat_count.rs:19:17
39   |
40LL |     let f = [0; -4_isize];
41   |                 ^^^^^^^^ expected `usize`, found `isize`
42   |
43help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
44   |
45LL |     let f = [0; (-4_isize).try_into().unwrap()];
46   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47
48error[E0308]: mismatched types
49  --> $DIR/repeat_count.rs:22:23
50   |
51LL |     let f = [0_usize; -1_isize];
52   |                       ^^^^^^^^ expected `usize`, found `isize`
53   |
54help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
55   |
56LL |     let f = [0_usize; (-1_isize).try_into().unwrap()];
57   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
58
59error: aborting due to 8 previous errors
60
61Some errors have detailed explanations: E0308, E0435.
62For more information about an error, try `rustc --explain E0308`.