Skip to content

ICE when matching an enum from a sibling module with a {} variant #7537

Closed
@SimonSapin

Description

@SimonSapin

I get ICEs with rust f348465 (used in Servo) for the following code. There is no error if the enum and match are in the same module, or if the enum has no {} variant.

a.rs:

use b::*;
mod b;

pub fn fuuu(a: A) -> int {
    match a {
        lol => 42,
        _ => 1,
    }
}

b.rs

pub enum A {
    lol,
    fuu{a: int},
}

c.rc

pub mod a;
pub mod b;
fn main(){}

Output:

% RUST_LOG=rustc=1,::rt::backtrace rustc c.rc 
rust: task failed at 'struct variant kinds unimpl in enum_variants', /home/simon/projects/rust/src/librustc/middle/ty.rs:4098
/home/simon/non-packages/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7fcd62be870b]
/home/simon/non-packages/bin/../lib/librustrt.so(+0x2a3a9)[0x7fcd62bf93a9]
/home/simon/non-packages/bin/../lib/librustrt.so(upcall_fail+0x198)[0x7fcd62bea658]
/home/simon/non-packages/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(_ZN3sys13begin_unwind_16_615cb041c655a976_07preE+0x63)[0x7fcd64c28cc3]
/home/simon/non-packages/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(+0x123c52)[0x7fcd64c28c52]
/home/simon/non-packages/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(_ZN3sys14__extensions__9meth_89449fail_with17_ac9eb45dc42bd6906_07preE+0x6b)[0x7fcd64b6835b]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x41fb20)[0x7fcd6323cb20]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x41f78c)[0x7fcd6323c78c]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle2ty13enum_variants16_bfaf9f09960f24c6_07preE+0x430)[0x7fcd62f562e0]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle2ty20enum_variant_with_id16_28d184f51b9a5546_07preE+0x6e)[0x7fcd630394fe]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check6_match17check_pat_variant16_89cbaa367e8eb636_07preE+0x825)[0x7fcd63305e55]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check6_match9check_pat17_aacdb0bc641839d36_07preE+0x7286)[0x7fcd63301216]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check6_match11check_match17_b2b718ab8c45a4176_07preE+0x409)[0x7fcd632f4e29]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check23check_expr_with_unifier17_de73127bc1f720266_07preE+0x5b52)[0x7fcd633de022]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check24check_expr_with_opt_hint17_3da35bbcf3bd40d56_07preE+0xa5)[0x7fcd633fa195]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check25check_block_with_expected16_d54a8e70ba2c25e6_07preE+0x7bd)[0x7fcd633a386d]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check8check_fn15_4e26cd1528d9fd6_07preE+0x15fd)[0x7fcd633a175d]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check13check_bare_fn14_db4ccfa8eddcf6_07preE+0x1e6)[0x7fcd6339fbf6]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check10check_item17_3b3d66d6c0e681126_07preE+0x56a)[0x7fcd6339eb0a]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x5813fd)[0x7fcd6339e3fd]
/home/simon/non-packages/bin/../lib/libsyntax-84efebcb12c867a2-0.7-pre.so(+0xf90c7)[0x7fcd63e7c0c7]
/home/simon/non-packages/bin/../lib/libsyntax-84efebcb12c867a2-0.7-pre.so(+0xf86aa)[0x7fcd63e7b6aa]
/home/simon/non-packages/bin/../lib/libsyntax-84efebcb12c867a2-0.7-pre.so(+0xf9733)[0x7fcd63e7c733]
/home/simon/non-packages/bin/../lib/libsyntax-84efebcb12c867a2-0.7-pre.so(+0xf86aa)[0x7fcd63e7b6aa]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x2d8dd1)[0x7fcd630f5dd1]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check16check_item_types17_9b946a891a2a91716_07preE+0x43e)[0x7fcd6339e18e]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x7180a2)[0x7fcd635350a2]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x717df9)[0x7fcd63534df9]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck11check_crate17_54349f39c7ca78196_07preE+0x295)[0x7fcd63532485]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6driver6driver12compile_rest17_32718fb030861ff16_07preE+0x1555)[0x7fcd6384eb75]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6driver6driver12compile_upto16_3b13f5438b2e4f86_07preE+0x192)[0x7fcd63854dd2]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6driver6driver13compile_input17_812b75735864b8556_07preE+0x107)[0x7fcd63855257]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN12run_compiler17_e6dc2544c438b05b6_07preE+0x2bbb)[0x7fcd63884d5b]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0xa7a80e)[0x7fcd6389780e]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0xa781bc)[0x7fcd638951bc]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0xa71bec)[0x7fcd6388ebec]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0xa7aae8)[0x7fcd63897ae8]
/home/simon/non-packages/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(+0xece75)[0x7fcd64bf1e75]
/home/simon/non-packages/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(+0x169058)[0x7fcd64c6e058]
/home/simon/non-packages/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7fcd62be9084]
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=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /home/simon/projects/rust/src/librustc/rustc.rc:355
/home/simon/non-packages/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7fcd62be870b]
/home/simon/non-packages/bin/../lib/librustrt.so(+0x2a3a9)[0x7fcd62bf93a9]
/home/simon/non-packages/bin/../lib/librustrt.so(upcall_fail+0x198)[0x7fcd62bea658]
/home/simon/non-packages/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(_ZN3sys13begin_unwind_16_615cb041c655a976_07preE+0x63)[0x7fcd64c28cc3]
/home/simon/non-packages/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(+0x123d72)[0x7fcd64c28d72]
/home/simon/non-packages/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(+0xc3c34)[0x7fcd64bc8c34]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN7monitor15_f69b167efde7bb6_07preE+0x2415)[0x7fcd63888355]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0xa7aae8)[0x7fcd63897ae8]
/home/simon/non-packages/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN4main15_c4de63b748e03d6_07preE+0x69)[0x7fcd63897749]
rustc(_rust_main+0x2e)[0x400c0e]
/home/simon/non-packages/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7fcd62be9084]
rust: domain main @0x193d410 root task failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions