2018-08-08 14:28:26 +02:00
|
|
|
error[E0435]: attempt to use a non-constant value in a constant
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/repeat_count.rs:5:17
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let a = [0; n];
|
|
|
|
| ^ non-constant value
|
2024-07-05 19:32:17 +00:00
|
|
|
|
|
|
|
|
help: consider using `const` instead of `let`
|
|
|
|
|
|
2024-07-08 19:43:20 +00:00
|
|
|
LL | const n: /* Type */ = 1;
|
|
|
|
| ~~~~~ ++++++++++++
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/repeat_count.rs:7:17
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let b = [0; ()];
|
2019-11-15 09:37:01 -08:00
|
|
|
| ^^ expected `usize`, found `()`
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2019-11-14 23:45:30 -08:00
|
|
|
--> $DIR/repeat_count.rs:10:17
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let c = [0; true];
|
2019-11-15 09:37:01 -08:00
|
|
|
| ^^^^ expected `usize`, found `bool`
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2019-11-14 23:45:30 -08:00
|
|
|
--> $DIR/repeat_count.rs:13:17
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let d = [0; 0.5];
|
2019-11-15 09:37:01 -08:00
|
|
|
| ^^^ expected `usize`, found floating-point number
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2019-11-14 23:45:30 -08:00
|
|
|
--> $DIR/repeat_count.rs:16:17
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let e = [0; "foo"];
|
2019-11-15 09:37:01 -08:00
|
|
|
| ^^^^^ expected `usize`, found `&str`
|
2018-08-08 14:28:26 +02:00
|
|
|
|
2022-06-22 19:12:18 -04:00
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/repeat_count.rs:31:17
|
|
|
|
|
|
|
|
|
LL | let g = [0; G { g: () }];
|
2023-01-02 18:00:33 -08:00
|
|
|
| ^^^^^^^^^^^ expected `usize`, found `G`
|
2022-06-22 19:12:18 -04:00
|
|
|
|
2018-08-08 14:28:26 +02:00
|
|
|
error[E0308]: mismatched types
|
2019-11-14 23:45:30 -08:00
|
|
|
--> $DIR/repeat_count.rs:19:17
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let f = [0; -4_isize];
|
2019-11-15 09:37:01 -08:00
|
|
|
| ^^^^^^^^ expected `usize`, found `isize`
|
2020-06-13 16:22:24 -07:00
|
|
|
|
|
2020-06-16 23:10:41 -07:00
|
|
|
= note: `-4_isize` cannot fit into type `usize`
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2019-11-14 23:45:30 -08:00
|
|
|
--> $DIR/repeat_count.rs:22:23
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let f = [0_usize; -1_isize];
|
2019-11-15 09:37:01 -08:00
|
|
|
| ^^^^^^^^ expected `usize`, found `isize`
|
2020-06-13 16:22:24 -07:00
|
|
|
|
|
2020-06-16 23:10:41 -07:00
|
|
|
= note: `-1_isize` cannot fit into type `usize`
|
2018-08-08 14:28:26 +02:00
|
|
|
|
2020-05-20 15:59:57 +02:00
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/repeat_count.rs:25:17
|
|
|
|
|
|
|
|
|
LL | let f = [0; 4u8];
|
|
|
|
| ^^^ expected `usize`, found `u8`
|
|
|
|
|
|
|
|
|
help: change the type of the numeric literal from `u8` to `usize`
|
|
|
|
|
|
|
|
|
LL | let f = [0; 4usize];
|
2021-08-10 10:53:43 +00:00
|
|
|
| ~~~~~
|
2020-05-20 15:59:57 +02:00
|
|
|
|
|
|
|
error: aborting due to 9 previous errors
|
2018-08-08 14:28:26 +02:00
|
|
|
|
2019-04-17 13:26:38 -04:00
|
|
|
Some errors have detailed explanations: E0308, E0435.
|
2018-08-08 14:28:26 +02:00
|
|
|
For more information about an error, try `rustc --explain E0308`.
|