Skip to content

ICE when type checking partially annotated patterns #57531

Closed
@matthewjasper

Description

@matthewjasper

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.

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️NLL-completeWorking towards the "valid code works" goal

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions