rust/tests/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.rs
Oli Scherer e44a7386c2 Remove dead code and extend test coverage and diagnostics around it
We lost the following comment during refactorings:

The current code for niche-filling relies on variant indices instead of actual discriminants, so enums with explicit discriminants (RFC 2363) would misbehave.
2025-07-24 10:21:20 +00:00

18 lines
362 B
Rust

#![crate_type = "lib"]
// Test that if any variant is non-unit,
// we need a repr.
enum Enum {
//~^ ERROR `#[repr(inttype)]` must be specified
Unit = 1,
Tuple(),
Struct {},
}
// Test that if any non-unit variant has an explicit
// discriminant we need a repr.
enum Enum2 {
//~^ ERROR `#[repr(inttype)]` must be specified
Tuple() = 2,
}