Skip to content
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

ICE when type checking partially annotated patterns #57531

Closed
matthewjasper opened this issue Jan 11, 2019 · 0 comments
Closed

ICE when type checking partially annotated patterns #57531

matthewjasper opened this issue Jan 11, 2019 · 0 comments
Assignees
Labels
A-NLL Area: Non-lexical lifetimes (NLL) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ NLL-complete Working towards the "valid code works" goal

Comments

@matthewjasper
Copy link
Contributor

The following code causes an ICE

fn main() {
    let x = Some(Some(Some(1)));

    match x {
        Some::<Option<_>>(Some(Some(v))) => (),
        _ => (),
    }
}

Message:

error: internal compiler error: src/librustc/mir/tcx.rs:139: cannot downcast non-ADT type: `Ty { ty: _ }`
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:588:9
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to previous error
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: rustc 1.33.0-nightly (c2d381d39 2019-01-10) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=1 -C llvm-args=--x86-asm-syntax=intel --crate-type rlib
Compiler returned: 101

This is marked as A-NLL because the bug is in MIR type check, even though it occurs with or without NLL.

@matthewjasper matthewjasper added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-NLL Area: Non-lexical lifetimes (NLL) labels Jan 11, 2019
@matthewjasper matthewjasper self-assigned this Jan 11, 2019
@nikomatsakis nikomatsakis added the NLL-complete Working towards the "valid code works" goal label Jan 23, 2019
bors added a commit that referenced this issue Jan 25, 2019
[NLL] Clean up handling of type annotations

* Renames (Canonical)?UserTypeAnnotation -> (Canonical)?UserType so that the name CanonicalUserTypeAnnotation is free.
* Keep the inferred type associated to user type annotations in the MIR, so that it can be compared against the annotated type, even when the annotated expression gets removed from the MIR. (#54943)
* Use the inferred type to allow infallible handling of user type projections (#57531)
* Uses revisions for the tests in #56993
* Check the types of `Unevaluated` constants with no annotations (#46702)
* Some drive-by cleanup

Closes #46702
Closes #54943
Closes #57531
Closes #57731
cc #56993 leaving this open to track the underlying issue: we are not running tests with full NLL enabled on CI at the moment

r? @nikomatsakis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-NLL Area: Non-lexical lifetimes (NLL) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ NLL-complete Working towards the "valid code works" goal
Projects
None yet
Development

No branches or pull requests

2 participants