2016-05-20 15:18:30 +02:00
|
|
|
enum Enum {
|
2022-05-27 15:42:15 +02:00
|
|
|
//~^ ERROR discriminant value `3` assigned more than once
|
2017-12-11 00:12:25 +03:00
|
|
|
P = 3,
|
2022-08-07 17:24:25 +02:00
|
|
|
//~^ NOTE `3` assigned here
|
2016-08-07 23:33:05 -07:00
|
|
|
X = 3,
|
2022-08-07 17:24:25 +02:00
|
|
|
//~^ NOTE `3` assigned here
|
2016-05-20 15:18:30 +02:00
|
|
|
Y = 5
|
|
|
|
}
|
|
|
|
|
2021-07-15 21:25:11 +02:00
|
|
|
#[repr(u8)]
|
|
|
|
enum EnumOverflowRepr {
|
2022-05-27 15:42:15 +02:00
|
|
|
//~^ ERROR discriminant value `1` assigned more than once
|
2021-07-15 21:25:11 +02:00
|
|
|
P = 257,
|
2022-08-07 17:24:25 +02:00
|
|
|
//~^ NOTE `1` (overflowed from `257`) assigned here
|
2021-07-15 21:25:11 +02:00
|
|
|
X = 513,
|
2022-08-07 17:24:25 +02:00
|
|
|
//~^ NOTE `1` (overflowed from `513`) assigned here
|
2022-05-27 15:42:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[repr(i8)]
|
|
|
|
enum NegDisEnum {
|
|
|
|
//~^ ERROR discriminant value `-1` assigned more than once
|
|
|
|
First = -1,
|
2022-08-07 17:24:25 +02:00
|
|
|
//~^ NOTE `-1` assigned here
|
2022-05-27 15:42:15 +02:00
|
|
|
Second = -2,
|
2022-08-07 17:24:25 +02:00
|
|
|
//~^ NOTE discriminant for `Last` incremented from this startpoint (`Second` + 1 variant later => `Last` = -1)
|
2022-05-27 15:42:15 +02:00
|
|
|
Last,
|
2022-08-07 17:24:25 +02:00
|
|
|
//~^ NOTE `-1` assigned here
|
|
|
|
}
|
|
|
|
|
|
|
|
enum MultipleDuplicates {
|
|
|
|
//~^ ERROR discriminant value `0` assigned more than once
|
2022-08-08 21:34:55 +02:00
|
|
|
//~^^ ERROR discriminant value `-2` assigned more than once
|
2022-08-07 17:24:25 +02:00
|
|
|
V0,
|
|
|
|
//~^ NOTE `0` assigned here
|
|
|
|
V1 = 0,
|
|
|
|
//~^ NOTE `0` assigned here
|
|
|
|
V2,
|
|
|
|
V3,
|
|
|
|
V4 = 0,
|
|
|
|
//~^ NOTE `0` assigned here
|
|
|
|
V5 = -2,
|
2022-08-08 21:34:55 +02:00
|
|
|
//~^ NOTE discriminant for `V7` incremented from this startpoint (`V5` + 2 variants later => `V7` = 0)
|
|
|
|
//~^^ NOTE `-2` assigned here
|
2022-08-07 17:24:25 +02:00
|
|
|
V6,
|
|
|
|
V7,
|
|
|
|
//~^ NOTE `0` assigned here
|
2022-08-08 21:34:55 +02:00
|
|
|
V8 = -3,
|
|
|
|
//~^ NOTE discriminant for `V9` incremented from this startpoint (`V8` + 1 variant later => `V9` = -2)
|
|
|
|
V9,
|
|
|
|
//~^ NOTE `-2` assigned here
|
2021-07-15 21:25:11 +02:00
|
|
|
}
|
|
|
|
|
2016-05-20 15:18:30 +02:00
|
|
|
fn main() {
|
|
|
|
}
|