fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
2.1 KiB74 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   |
13   = note: expected type `usize`
14              found type `()`
15
16error[E0308]: mismatched types
17  --> $DIR/repeat_count.rs:12:17
18   |
19LL |     let c = [0; true];
20   |                 ^^^^ expected usize, found bool
21
22error[E0308]: mismatched types
23  --> $DIR/repeat_count.rs:15:17
24   |
25LL |     let d = [0; 0.5];
26   |                 ^^^ expected usize, found floating-point number
27   |
28   = note: expected type `usize`
29              found type `{float}`
30
31error[E0308]: mismatched types
32  --> $DIR/repeat_count.rs:20:17
33   |
34LL |     let e = [0; "foo"];
35   |                 ^^^^^ expected usize, found reference
36   |
37   = note: expected type `usize`
38              found type `&'static str`
39
40error[E0308]: mismatched types
41  --> $DIR/repeat_count.rs:25:17
42   |
43LL |     let f = [0; -4_isize];
44   |                 ^^^^^^^^ expected usize, found isize
45   |
46help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
47   |
48LL |     let f = [0; (-4_isize).try_into().unwrap()];
49   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50
51error[E0308]: mismatched types
52  --> $DIR/repeat_count.rs:28:23
53   |
54LL |     let f = [0_usize; -1_isize];
55   |                       ^^^^^^^^ expected usize, found isize
56   |
57help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
58   |
59LL |     let f = [0_usize; (-1_isize).try_into().unwrap()];
60   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61
62error[E0308]: mismatched types
63  --> $DIR/repeat_count.rs:34:17
64   |
65LL |     let g = [0; G { g: () }];
66   |                 ^^^^^^^^^^^ expected usize, found struct `main::G`
67   |
68   = note: expected type `usize`
69              found type `main::G`
70
71error: aborting due to 8 previous errors
72
73Some errors have detailed explanations: E0308, E0435.
74For more information about an error, try `rustc --explain E0308`.