Skip to content

ICE: const pattern should've been rewritten #32086

Closed
@petrochenkov

Description

@petrochenkov

Code:

struct S(u8);
const C: S = S(10);

fn main() {
    let C(a) = S(11); // Or let C(..) = S(11);
}

This reproduces on nightly and beta, but not on stable, i.e. this is a regression.

Backtrace:

#0  0x000000006dee288a in rust_panic ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\std-9026086f.dll
#1  0x000000006dec5806 in sys_common::unwind::begin_unwind_inner::h08f3605bf700f6cbZmu ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\std-9026086f.dll
#2  0x00000000690db7cc in sys_common::unwind::begin_unwind::h13931765099616548055 ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc-9026086f.dll
#3  0x00000000690db762 in errors::Handler::span_bug::h7367734010347099699 ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc-9026086f.dll
#4  0x000000006914f458 in middle::check_match::pat_constructors::h639f0f24d8911731EHj ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc-9026086f.dll
#5  0x000000006914e7bf in iter::FlatMap$LT$I$C$$u20$U$C$$u20$F$GT$.Iterator::next::h4601516566142449238 ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc-9026086f.dll
#6  0x000000006914d1fe in middle::check_match::missing_constructors::h0d906012fb7d9d17Fuj ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc-9026086f.dll
#7  0x000000006912d909 in middle::check_match::is_useful::h1c332fdbff74f7b19wj
    ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc-9026086f.dll
#8  0x0000000069155580 in middle::check_match::check_irrefutable::h09337786e8a0201102j ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc-9026086f.dll
#9  0x00000000691214a2 in middle::check_match::check_local::h98152a46f3a8bae6U0j ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc-9026086f.dll
#10 0x0000000069121708 in middle::check_match::check_fn::h8eba982511d4cb39K1j
    ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc-9026086f.dll
#11 0x0000000069121ef3 in middle::check_match::check_crate::hc25947a53fcb716bOQi ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc-9026086f.dll
#12 0x0000000065fcc8cb in driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::closure.27291 ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-9026086f.dll
#13 0x0000000065fc96fd in middle::ty::context::TyCtxt$LT$$u27$tcx$GT$::create_and_enter::h10866479589336201043 ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-9026086f.dll
#14 0x0000000065fc6454 in driver::phase_3_run_analysis_passes::h14247926337360009039 ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-9026086f.dll
#15 0x0000000065f97e2d in driver::compile_input::h0d6a8e68a8acbb0fKca ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-9026086f.dll
#16 0x0000000065f8622d in run_compiler::h8175128cb8d7abab8Oc ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-9026086f.dll
#17 0x0000000065f8373c in sys_common::unwind::try::try_fn::h12916534343448997570 ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-9026086f.dll
#18 0x000000006def154b in sys_common::unwind::inner_try::hcf9eff4e967005e71ju
    ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\std-9026086f.dll
#19 0x0000000065f83fcd in boxed::F.FnBox$LT$A$GT$::call_box::h1183136542718888905 ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\rustc_driver-9026086f.dll
#20 0x000000006df02faa in sys::thread::Thread::new::thread_start::h4da80f6618e38786MFz ()
   from C:\msys64\home\we\rust\x86_64-pc-windows-gnu\stage1\bin\std-9026086f.dll
#21 0x00007ffd9c1713d2 in KERNEL32!BaseThreadInitThunk ()
   from C:\Windows\system32\kernel32.dll
#22 0x00007ffd9dcb54e4 in ntdll!RtlUserThreadStart ()
   from C:\Windows\SYSTEM32\ntdll.dll
#23 0x0000000000000000 in ?? ()

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