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: const pattern should've been rewritten #32086

Closed
petrochenkov opened this issue Mar 6, 2016 · 1 comment · Fixed by #34095
Closed

ICE: const pattern should've been rewritten #32086

petrochenkov opened this issue Mar 6, 2016 · 1 comment · Fixed by #34095
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@petrochenkov
Copy link
Contributor

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 ?? ()
@sanxiyn sanxiyn added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 7, 2016
@oli-obk
Copy link
Contributor

oli-obk commented Mar 7, 2016

might have been caused by #30141 ... evaluating...
or one of these which are more related:

af55b41
4573bb8

bors added a commit that referenced this issue Jun 9, 2016
Improvements to pattern resolution + some refactoring

Continuation of #33929
First commit is a careful rewrite of `resolve_pattern`, pattern path resolution and new binding creation logic is factored out in separate functions, some minor bugs are fixed. Also, `resolve_possibly_assoc_item` doesn't swallow modules now.
Later commits are refactorings, see the comment descriptions.

I intend to continue this work later with better support for `Def::Err` in patterns in post-resolve stages and cleanup of pattern resolution code in type checker.

Fixes #32086
Fixes #34047 ([breaking-change])
Fixes #34074

cc @jseyfried
r? @eddyb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants