Skip to content

ICE in ty_fn_sig() with polymorphic values #6458

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

Closed
ssbr opened this issue May 13, 2013 · 7 comments
Closed

ICE in ty_fn_sig() with polymorphic values #6458

ssbr opened this issue May 13, 2013 · 7 comments
Labels
A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@ssbr
Copy link
Contributor

ssbr commented May 13, 2013

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
@alexcrichton
Copy link
Member

I also get it with this small program:

fn foo<T>(t: T) {}
fn main() { foo(fail!()); }

@jdm
Copy link
Contributor

jdm commented May 14, 2013

@catamorphism This might relate to your derived type error work.

@bblum
Copy link
Contributor

bblum commented Jun 5, 2013

Use of fmt! with polymorphic values can also trigger this.

fn main() {
    fmt!("%?", None);
}

@bblum
Copy link
Contributor

bblum commented Jun 10, 2013

haha oops, ran into it again when trying to return a transmuted value (accidentally had a semicolon on the end)

use std::cast;

fn main() {
    cast::transmute(0);
}

@metajack
Copy link
Contributor

I think I just ran into this. Here's the extracted code:

fn foo(b: bool) -> Result<bool,~str> {
    Err(~"bar");
}

fn main() {
    foo(false);
}

Removing the semi-colon fixes the issue.

@metajack
Copy link
Contributor

nominating for production ready

@catamorphism
Copy link
Contributor

This is fixed. I'll check in test cases.

catamorphism added a commit to catamorphism/rust that referenced this issue Aug 12, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 20, 2020
needless_doctest_main: handle correctly parse errors

Before this change, finding an error when parsing a doctest would make Clippy exit without emitting an error. Now we properly catch a fatal error and ignore it.

Also, if a doctest specifies an edition in the info line, it will be used when parsing it.

changelog: needless_doctest_main: handle correctly parse errors

Fixes rust-lang#6022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants