mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 10:18:25 +00:00

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.
18 lines
362 B
Rust
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,
|
|
}
|