-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Internal compiler error when matching integers against casted enum constants #24106
Comments
Here’s a minimized test case. $ rustc --version --verbose
rustc 1.0.0-nightly (083b8a404 2015-04-05) (built 2015-04-05)
binary: rustc
commit-hash: 083b8a40413eb3dfec7430150b8895f6c8bbafca
commit-date: 2015-04-05
build-date: 2015-04-05
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
$ cat foo.rs
#![crate_type = "rlib"]
enum E { E0 = 0, E1 = 1 }
const E0_U8: u8 = E::E0 as u8;
const E1_U8: u8 = E::E1 as u8;
pub fn go<T>() {
match 0 {
E0_U8 => (),
E1_U8 => (),
_ => (),
}
}
$ cat bar.rs
extern crate foo;
fn main() {
foo::go::<()>();
}
$ rustc foo.rs
$ rustc bar.rs -L .
foo.rs:4:19: 4:30 error: non-constant path in constant expr
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'compare_list_exprs: type mismatch', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_trans/trans/_match.rs:238 |
This no longer ICEs |
I would like to have a go at this issue since it is marked I do wonder though how I would go about making a test case. |
@TheNeikos ( |
So what I found out that happens: src/librustc_trans/trans/_match.rs:243 gets a None value I added a
The output of that println is: Where as the error that occurs through which a None is returned is: I am not sure what I should check out first, any pointers? |
This still ICEs and isn't |
Haha, alright, well if it is indeed more complicated, I will step back from it. |
Triage: still repros. Error shows a bit more
|
The minimized example does compile without any error for me on rustc 1.12.1 (d4f3940 2016-10-19) |
Add regression test for issue rust-lang#24106 Fixes rust-lang#24106.
I get “error: internal compiler error: unexpected panic” when running
cargo test
on andersk/image-rs@a9d74e9, which contains theimage
crate patched as follows. (I was trying to find an alternative to the unstableFromPrimitive
.)The text was updated successfully, but these errors were encountered: