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 incorrect number of bindings present #2849

Closed
jdm opened this issue Jul 9, 2012 · 2 comments
Closed

ICE when incorrect number of bindings present #2849

jdm opened this issue Jul 9, 2012 · 2 comments
Labels
A-resolve Area: Name resolution A-typesystem Area: The type system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Milestone

Comments

@jdm
Copy link
Contributor

jdm commented Jul 9, 2012

enum foo {
    alpha,
    beta(int),
}

fn main() {
    alt alpha {
      alpha | beta(i) {}
    }
}

yields

binding.rs:8:14: 8:23 error: inconsistent number of bindings
binding.rs:8       alpha | beta(i) {}
                           ^~~~~~~~~
rust: task failed at 'Key not found in table', /Users/jdm/src/rust/src/rustc/rustc.rc:1
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=0,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /Users/jdm/src/rust/src/rustc/driver/rustc.rs:256
rust: domain main @0x103800010 root task failed
rust: task failed at 'killed', /Users/jdm/src/rust/src/libcore/task.rs:462

and gdb shows

#0  0x000000010170b044 in upcall_fail () from /usr/local/bin/../lib/librustrt.dylib
#1  0x000000010107350b in map::chained::hashmap::get13156::_9519fedd8db8443a::_02 () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#2  0x000000010106d189 in middle::typeck::check::alt::check_pat::_735aacb92c5befd8::_02 () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#3  0x0000000101071d0d in middle::typeck::check::alt::check_pat_variant::_70fefd3ec2a62373::_02 () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#4  0x000000010106b709 in middle::typeck::check::alt::check_pat::_735aacb92c5befd8::_02 () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#5  0x0000000101069f89 in middle::typeck::check::alt::check_alt::anon () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#6  0x0000000101314e99 in __morestack () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#7  0x00000001010c68f7 in middle::typeck::check::check_expr_with_unifier::_c9618d6bfc84ac53::_02 () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#8  0x0000000101314e99 in __morestack () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#9  0x0000000101070386 in middle::typeck::check::check_block::_3937c7d1a552542a::_02 () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#10 0x000000010109a32a in middle::typeck::check::check_fn::_fd3a95ac867444d2::_02 () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#11 0x0000000101099019 in middle::typeck::check::check_bare_fn::_6cd7565dc3651c91::_02 () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#12 0x000000010109765c in middle::typeck::check::check_item_types::anon () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#13 0x00000001005ea9b3 in visit::mk_simple_visitor::anon () from /usr/local/bin/../lib/libsyntax-b45cc7d0b085bc34-0.2.dylib
#14 0x00000001005ea894 in visit::mk_simple_visitor::anon () from /usr/local/bin/../lib/libsyntax-b45cc7d0b085bc34-0.2.dylib
#15 0x000000010112c8a0 in middle::typeck::check_crate::_3897182f6531c71d::_02 () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#16 0x00000001012f4d05 in driver::driver::compile_upto::anon () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#17 0x0000000101314e99 in __morestack () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#18 0x00000001012f264b in driver::driver::compile_upto::_4c9a560284d92cff::_02 () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#19 0x0000000101314e99 in __morestack () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#20 0x00000001012f57eb in driver::driver::compile_input::_4962031f597bd44b::_02 () from /usr/local/bin/../lib/librustc-73389320c1332876-0.2.dylib
#21 0x0000000100004b9a in run_compiler::_e12b2bba37979b8f::_00 ()
#22 0x000000010000c9a6 in __morestack ()
#23 0x0000000100009e8e in monitor::anon ()
#24 0x0000000100009418 in task::try552::anon ()
#25 0x0000000100033a95 in task::spawn_raw::anon () from /usr/local/bin/../lib/libcore-d27e4777a53c3e50-0.2.dylib
#26 0x0000000101708273 in task_start_wrapper(spawn_args*) () from /usr/local/bin/../lib/librustrt.dylib
@ghost ghost assigned catamorphism Jul 9, 2012
@catamorphism
Copy link
Contributor

@pcwalton says that the bug here is a known bug in the old resolve pass, which results in typeck happening even when there's a resolve error. This should be fixed when resolve 3 is live; leaving it open until then so I can re-test.

@catamorphism
Copy link
Contributor

This turned out to still be a bug in resolve3, because the code that checked that all patterns in an arm bind the same number of variables hadn't been implemented. Fixed in f39477d and added this as a test case.

RalfJung pushed a commit to RalfJung/rust that referenced this issue Apr 28, 2023
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Shorten the tables frames in the `expected` file for the
`cargo-kani/assess-artifacts` test. Otherwise, the test will fail when
running the regression suite in a shorter-than-usual directory path
(e.g., `/tmp/kani`). Came across this problem this morning when
preparing for the release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name resolution A-typesystem Area: The type system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

2 participants