Skip to content

ICE when matching a dereferenced complex newtype against the newtype #5358

Closed

Description

@jdm

This doesn't reproduce if the inner type is something like uint or a tuple.

struct S(Either<uint, uint>);

fn main() {
    match *S(Left(5)) {
      S(_) => {}
    }
}
#0  rust_task_fail (task=0x7ffff0108840, expr=0x7fffe84aaa00 "non-variant in variant_def_ids", file=0x7fffe8500020 "/run/media/jdm/ssd/rust/src/libsyntax/ast_util.rs", line=56)
    at /run/media/jdm/ssd/rust/src/rt/rust_task.cpp:86
#1  0x00007ffff54c7f89 in __morestack () from /usr/local/bin/../lib/librustrt.so
#2  0x00007ffff54b9310 in call_on_c_stack (fn_ptr=0x7ffff54b8c50, args=0x7fffe84c75d0, this=0x7ffff0108840) at /run/media/jdm/ssd/rust/src/rt/rust_task.h:478
#3  call_upcall_on_c_stack (fn_ptr=0x7ffff54b8c50, args=0x7fffe84c75d0, task=<optimized out>) at /run/media/jdm/ssd/rust/src/rt/rust_upcall.cpp:45
#4  upcall_fail (expr=0x7fffe84aaa00 "non-variant in variant_def_ids", file=0x7fffe8500020 "/run/media/jdm/ssd/rust/src/libsyntax/ast_util.rs", line=<optimized out>)
    at /run/media/jdm/ssd/rust/src/rt/rust_upcall.cpp:128
#5  0x00007ffff7df764b in sys::begin_unwind_::_15feb4cf285334c::_06 () from /usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.6.so
#6  0x00007ffff7df75f2 in sys::begin_unwind::anon::anon::expr_fn_14907 () from /usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.6.so
#7  0x00007ffff7d43841 in sys::begin_unwind::_7cd364c41f10422f::_06 () from /usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.6.so
#8  0x00007ffff7706978 in ast_util::variant_def_ids::_3d7eb41736c5c9c2::_06 () from /usr/local/bin/../lib/libsyntax-84efebcb12c867a2-0.6.so
#9  0x00007ffff6fce8de in middle::typeck::check::_match::check_pat_variant::_d8e21dceec5748a4::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#10 0x00007ffff6fc5ad1 in middle::typeck::check::_match::check_pat::_247b57ac05e9c3a::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#11 0x00007ffff6fc4b81 in middle::typeck::check::_match::check_match::anon::anon::expr_fn_46280 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#12 0x00007ffff6fc0d1e in middle::typeck::check::_match::check_match::_65f784dac8c7f663::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#13 0x00007ffff7074177 in middle::typeck::check::check_expr_with_unifier::_25cf209ab3c96f51::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#14 0x00007ffff7415bd4 in __morestack () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#15 0x00007ffff7097cf5 in middle::typeck::check::check_block_with_expected::_888444d59fddd80::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#16 0x00007ffff7034e69 in middle::typeck::check::check_fn::_ecb27be33c3c5a40::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#17 0x00007ffff7033801 in middle::typeck::check::check_bare_fn::_c72a4e9be7a1727::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#18 0x00007ffff7032470 in middle::typeck::check::check_item::_a08daccad7d15d75::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#19 0x00007ffff7752d4d in visit::mk_simple_visitor::anon::expr_fn_14978 () from /usr/local/bin/../lib/libsyntax-84efebcb12c867a2-0.6.so
#20 0x00007ffff7752ad4 in visit::mk_simple_visitor::anon::expr_fn_14968 () from /usr/local/bin/../lib/libsyntax-84efebcb12c867a2-0.6.so
#21 0x00007ffff7031eaa in middle::typeck::check::check_item_types::_d2cbaf833791f793::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#22 0x00007ffff715e7f3 in middle::typeck::check_crate::_22e2488ce88a679::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#23 0x00007ffff73d3920 in driver::driver::compile_rest::_322442719405eb4::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#24 0x00007ffff7415bd4 in __morestack () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#25 0x00007ffff73d8237 in driver::driver::compile_upto::_0d5725aa2ada48::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#26 0x00007ffff7415bd4 in __morestack () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#27 0x00007ffff73d8639 in driver::driver::compile_input::_6fac692b26553d54::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#28 0x00007ffff74067ef in run_compiler::_104083f5e46aacf5::_06 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#29 0x00007ffff7413511 in monitor::anon::expr_fn_82475 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#30 0x00007ffff740f93b in task::__extensions__::try_81986::anon::expr_fn_82249 () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#31 0x00007ffff7415bd4 in __morestack () from /usr/local/bin/../lib/librustc-c84825241471686d-0.6.so
#32 0x00007ffff7dc167e in task::spawn::spawn_raw::make_child_wrapper::anon::expr_fn_12367 () from /usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.6.so
#33 0x00007ffff7e41034 in __morestack () from /usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.6.so
#34 0x00007ffff54b7d14 in task_start_wrapper (a=0x7ffff0109670) at /run/media/jdm/ssd/rust/src/rt/rust_task.cpp:162

Activity

  1. catamorphism commented on May 2, 2013

    @catamorphism
    Contributor

    Fixed pending #6200

  2. catamorphism commented on May 4, 2013

    @catamorphism
    Contributor

    Fixed in 517bfc9

  3. added a commit that references this issue on Aug 21, 2026
  4. added a commit that references this issue on Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions