-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
compiler crash on innocent-looking match #46964
Labels
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Comments
Slightly simplified version (it's not valid Rust code -- not all patterns are covered -- but it crashes the compiler):
Backtrace with debug logging from rustc (RUST_BACKTRACE=full RUST_LOG=rustc_const_eval):
|
Minified: mod my_mod {
#[derive(Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash)]
pub struct Name<'a> {
source: &'a str,
}
pub const JSON: Name = Name { source: "JSON" };
}
pub fn crash() -> bool {
match (my_mod::JSON, None) {
(_, Some(my_mod::JSON)) => true,
(my_mod::JSON, None) => true,
_ => false,
}
}
fn main() {} |
bors
added a commit
that referenced
this issue
Jan 21, 2018
check_match: fix handling of privately uninhabited types the match-checking code used to use TyErr for signaling "unknown, inhabited" types for a long time. It had been switched to using the exact type in #38069, to handle uninhabited types. However, in #39980, we discovered that we still needed the "unknown inhabited" logic, but I used `()` instead of `TyErr` to handle that. Revert to using `TyErr` to fix that problem. Fixes #46964. r? @nikomatsakis
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the compiler unexpectedly panicked. this is a bug.
I tried this code (hyper = "0.11.9"):
I expected to see this happen: code compiles (two top branches are incompatible)
Instead, this happened: compiler crashed; re-ordering two top branches fixes the issue
Meta
rustc --version --verbose
:Backtrace:
The text was updated successfully, but these errors were encountered: