Skip to content

ICE when matching an enum with a struct pattern of the same name #17405

Closed
@ghost

Description

enum Foo {
    Bar(int)
}

fn main() {
    match Bar(1i) {
        Foo { i } => ()
    }
}
<anon>:7:9: 7:18 error: mismatched types: expected `Foo`, found `Foo` [E0028]
<anon>:7         Foo { i } => ()
                 ^~~~~~~~~
error: internal compiler error: no type for node 19: local i (id=19) in fcx 0x7f9f78bf1c20

stack backtrace:
   1:        0x10510ea59 - rt::backtrace::imp::write::h298a03c096c543d5UTq
   2:        0x105111db1 - failure::on_fail::hb95817d5813acefayar
   3:        0x10539b0c5 - unwind::begin_unwind_inner::h38204eb0df1d57aePQd
   4:        0x103132887 - unwind::begin_unwind::h5140898913632781757
   5:        0x1031330c3 - diagnostic::Handler::bug::h437fe243489f6650EVE
   6:        0x101cc2e58 - driver::session::Session::bug::h80c1938a85b3e818WVx
   7:        0x1021fb851 - middle::typeck::check::FnCtxt<'a, 'tcx>::node_ty::h83a1d573a41ff558lXU
   8:        0x10220f7c3 - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>::visit_node_id::h5cb8c3e3598edb5029L
   9:        0x10220e17c - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_pat::h24d8f535e4d3d5bdY0L
  10:        0x10220e3ab - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_pat::h24d8f535e4d3d5bdY0L
  11:        0x10220c11d - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h41b5c248bcf967522YL
  12:        0x10220de92 - middle::typeck::check::writeback::resolve_type_vars_in_fn::h8a352e858e09982bCTL
  13:        0x102265ee4 - middle::typeck::check::check_bare_fn::h780b9a9c1afeed9ejJS
  14:        0x10225ef7a - middle::typeck::check::check_item::h94720c103d40ef3bYgT
  15:        0x102265c2c - middle::typeck::check::check_item_types::h4912f9ac8f5c9396hIS
  16:        0x101cd8166 - util::common::time::h12840183431291928660
  17:        0x102541aec - middle::typeck::check_crate::h03c96b8190b97a65zIk
  18:        0x1025ada97 - driver::driver::phase_3_run_analysis_passes::hfb228f5c04a656c6xcx

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions