fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.9 KiB69 linesraw
1error[E0435]: attempt to use a non-constant value in a constant
2  --> $DIR/repeat_count.rs:5:17
3   |
4LL |     let n = 1;
5   |     ----- help: consider using `const` instead of `let`: `const n`
6LL |     let a = [0; n];
7   |                 ^ non-constant value
8
9error[E0308]: mismatched types
10  --> $DIR/repeat_count.rs:7:17
11   |
12LL |     let b = [0; ()];
13   |                 ^^ expected `usize`, found `()`
14
15error[E0308]: mismatched types
16  --> $DIR/repeat_count.rs:10:17
17   |
18LL |     let c = [0; true];
19   |                 ^^^^ expected `usize`, found `bool`
20
21error[E0308]: mismatched types
22  --> $DIR/repeat_count.rs:13:17
23   |
24LL |     let d = [0; 0.5];
25   |                 ^^^ expected `usize`, found floating-point number
26
27error[E0308]: mismatched types
28  --> $DIR/repeat_count.rs:16:17
29   |
30LL |     let e = [0; "foo"];
31   |                 ^^^^^ expected `usize`, found `&str`
32
33error[E0308]: mismatched types
34  --> $DIR/repeat_count.rs:31:17
35   |
36LL |     let g = [0; G { g: () }];
37   |                 ^^^^^^^^^^^ expected `usize`, found `G`
38
39error[E0308]: mismatched types
40  --> $DIR/repeat_count.rs:19:17
41   |
42LL |     let f = [0; -4_isize];
43   |                 ^^^^^^^^ expected `usize`, found `isize`
44   |
45   = note: `-4_isize` cannot fit into type `usize`
46
47error[E0308]: mismatched types
48  --> $DIR/repeat_count.rs:22:23
49   |
50LL |     let f = [0_usize; -1_isize];
51   |                       ^^^^^^^^ expected `usize`, found `isize`
52   |
53   = note: `-1_isize` cannot fit into type `usize`
54
55error[E0308]: mismatched types
56  --> $DIR/repeat_count.rs:25:17
57   |
58LL |     let f = [0; 4u8];
59   |                 ^^^ expected `usize`, found `u8`
60   |
61help: change the type of the numeric literal from `u8` to `usize`
62   |
63LL |     let f = [0; 4usize];
64   |                  ~~~~~
65
66error: aborting due to 9 previous errors
67
68Some errors have detailed explanations: E0308, E0435.
69For more information about an error, try `rustc --explain E0308`.