-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ICE on with #[repr(..)] for single-variant enum #34571
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
cc @eddyb |
How does this not trigger an error? |
Note that adding a second variant reports no error at all (I stumbled upon this ICE as well, just now): #[repr(u8)]
enum Foo {
Foo(u8),
Bar
} Edit: this is already tracked at #31692 |
Probably relevant from #25651:
|
This has become a regression (probably since #34846 was merged): The following compiles fine on stable, beta and nightly-2016-07-12 but fails on later nightlies. #[repr(C)]
pub enum TupleSingle {
Tuple(u8),
}
fn main() {} |
Interestingly, it's only a regression if the enum was completely unused before. @eddyb's type layout code will be invoked for all types that are lowered down to an LLVM representation, which doesn't happen if the type is unused. This ICEs on stable, too: #[repr(u8)]
pub enum TupleSingle {
Tuple(u8),
}
fn main() {
let t = TupleSingle::Tuple(0);
} |
Doesn't seem to reproduce anymore?
|
…excrichton Add a test for issue 34571 Closes rust-lang#34571.
…excrichton Add a test for issue 34571 Closes rust-lang#34571.
…excrichton Add a test for issue 34571 Closes rust-lang#34571.
…excrichton Add a test for issue 34571 Closes rust-lang#34571.
…excrichton Add a test for issue 34571 Closes rust-lang#34571.
Same error on all nightly and stable:
The text was updated successfully, but these errors were encountered: