Skip to content

ICE in ty_fn_sig() with polymorphic values #6458

Closed
@ssbr

Description

@ssbr

Sorry, I don't know a good title for this. (EDIT(bblum): better title)

I was playing with Rust and types and so on, and ended up with the following minimal test case for my problem:

pub struct TypeWithState<State>;
pub struct MyState;

pub fn foo<State>(_: TypeWithState<State>) {}

pub fn bar() {
    foo(TypeWithState); // I guess I was meant to write "::<MyState>"
}

The following is the result of compilation:

$ RUST_LOG=rustc=1,::rt::backtrace rustc --lib testsrc/ice1.rs
rust: task failed at 'ty_fn_sig() called on non-fn type: &ty_err', /home/devin/local_programming/rust/src/librustc/middle/ty.rs:3004
/usr/local/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7fe053350ccb]
/usr/local/bin/../lib/librustrt.so(+0x2c869)[0x7fe053361869]
/usr/local/bin/../lib/librustrt.so(upcall_fail+0x1a0)[0x7fe053352c80]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(_ZN3sys13begin_unwind_16_615cb041c655a976_07preE+0x63)[0x7fe0553a7513]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(+0x1294a2)[0x7fe0553a74a2]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(_ZN3sys14__extensions__9meth_89449fail_with17_ac9eb45dc42bd6906_07preE+0x6b)[0x7fe0552e6bab]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle2ty9ty_fn_sig16_47bf22f8112582a6_07preE+0x209)[0x7fe0539987d9]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x5504a8)[0x7fe053ad54a8]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x548cf6)[0x7fe053acdcf6]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x23eee2)[0x7fe0537c3ee2]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x23ebc9)[0x7fe0537c3bc9]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x22f7ea)[0x7fe0537b47ea]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x54ba05)[0x7fe053ad0a05]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check8regionck11regionck_fn17_1cbda8e01e29b9ee6_07preE+0x1bc)[0x7fe053ac5f1c]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check13check_bare_fn14_db4ccfa8eddcf6_07preE+0x303)[0x7fe053b10963]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check10check_item17_3b3d66d6c0e681126_07preE+0x56a)[0x7fe053b0f75a]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x58a04d)[0x7fe053b0f04d]
/usr/local/bin/../lib/libsyntax-84efebcb12c867a2-0.7-pre.so(+0xfd2d7)[0x7fe0545f12d7]
/usr/local/bin/../lib/libsyntax-84efebcb12c867a2-0.7-pre.so(+0xfc8ba)[0x7fe0545f08ba]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x2e1b21)[0x7fe053866b21]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck5check16check_item_types17_9b946a891a2a91716_07preE+0x43e)[0x7fe053b0edde]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x720d32)[0x7fe053ca5d32]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0x720a89)[0x7fe053ca5a89]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6middle6typeck11check_crate17_54349f39c7ca78196_07preE+0x295)[0x7fe053ca3115]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6driver6driver12compile_rest17_32718fb030861ff16_07preE+0x1555)[0x7fe053fbf975]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6driver6driver12compile_upto16_3b13f5438b2e4f86_07preE+0x192)[0x7fe053fc5bd2]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN6driver6driver13compile_input17_812b75735864b8556_07preE+0x107)[0x7fe053fc6057]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN12run_compiler17_e6dc2544c438b05b6_07preE+0x2bbb)[0x7fe053ff5a4b]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0xa834fe)[0x7fe0540084fe]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0xa80eac)[0x7fe054005eac]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0xa7a8dc)[0x7fe053fff8dc]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0xa837d8)[0x7fe0540087d8]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(+0xf26c5)[0x7fe0553706c5]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(+0x16e8a8)[0x7fe0553ec8a8]
/usr/local/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7fe053351674]
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/devin/local_programming/rust/src/librustc/rustc.rc:355
/usr/local/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7fe053350ccb]
/usr/local/bin/../lib/librustrt.so(+0x2c869)[0x7fe053361869]
/usr/local/bin/../lib/librustrt.so(upcall_fail+0x1a0)[0x7fe053352c80]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(_ZN3sys13begin_unwind_16_615cb041c655a976_07preE+0x63)[0x7fe0553a7513]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(+0x1295c2)[0x7fe0553a75c2]
/usr/local/bin/../lib/libcore-c3ca5d77d81b46c1-0.7-pre.so(+0xc9484)[0x7fe055347484]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN7monitor15_f69b167efde7bb6_07preE+0x2415)[0x7fe053ff9045]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(+0xa837d8)[0x7fe0540087d8]
/usr/local/bin/../lib/librustc-c84825241471686d-0.7-pre.so(_ZN4main15_c4de63b748e03d6_07preE+0x69)[0x7fe054008439]
rustc(_rust_main+0x2e)[0x400c8e]
/usr/local/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x24)[0x7fe053351674]
rust: domain main @0x10a5410 root task failed

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

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions