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

Static vector with mismatched function value causes compiler error #9943

Closed
geoffhill-zz opened this issue Oct 19, 2013 · 2 comments
Closed
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@geoffhill-zz
Copy link
Contributor

The following snippet tries to put a generic function into a non-generic function vector.

fn foo<T>(_x: &T) {}

static FOOS: &'static [fn(&uint)] = &[foo];

fn main() {}

When I try to compile this with the current upstream master (a1b25f2), I get:

% ./rustc -L. datasets/rust3.rs
error: internal compiler error: type_of with ty_param
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at '~Any', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/diagnostic.rs:155
stack backtrace:
   1:        0x10c5dcb74 - rt::backtrace::imp::write::hacf7ed738bbd3a43WEa::v0.11.pre
   2:        0x10c53111e - rt::unwind::begin_unwind_inner::h556f68d691cc50912ea::v0.11.pre
   3:        0x10bc67aa5 - rt::unwind::begin_unwind::h7101720994769804464::v0.11.pre
   4:        0x10bc68afa - diagnostic::Handler::bug::h8fe91a431cd0d4bbBYb::v0.11.pre
   5:        0x1098c59f8 - driver::session::Session::bug::h854d2d1ae83369e71Yg::v0.11.pre
   6:        0x1099098f2 - middle::trans::type_of::type_of::h9e9bd456dee4c7c7uwk::v0.11.pre
   7:        0x109909272 - middle::trans::type_of::type_of::h9e9bd456dee4c7c7uwk::v0.11.pre
   8:        0x109908bfa - middle::trans::type_of::type_of::h9e9bd456dee4c7c7uwk::v0.11.pre
   9:        0x109988c3c - middle::trans::type_of::type_of_rust_fn::h652025f5c45740c9Hok::v0.11.pre
  10:        0x1099a1cd7 - middle::trans::base::decl_rust_fn::h7fcff06991ec4dfa2yn::v0.11.pre
  11:        0x1099b4c77 - middle::trans::base::register_fn::he516f08159ccf4520rp::v0.11.pre
  12:        0x1098c330e - middle::trans::base::get_item_val::hc072751c32542e62aFp::v0.11.pre
  13:        0x109980fb5 - middle::trans::consts::const_expr_unadjusted::hf182b51642cbb79bBOj::v0.11.pre
  14:        0x10997d559 - middle::trans::consts::const_expr::h3b03bdc3423a84b6Lyj::v0.11.pre
  15:        0x10997cafe - middle::trans::consts::const_vec::h8dd03edee92d91bcomj::v0.11.pre
  16:        0x1099817ff - middle::trans::consts::const_expr_unadjusted::hf182b51642cbb79bBOj::v0.11.pre
  17:        0x10997d559 - middle::trans::consts::const_expr::h3b03bdc3423a84b6Lyj::v0.11.pre
  18:        0x1098c346a - middle::trans::base::get_item_val::hc072751c32542e62aFp::v0.11.pre
  19:        0x10997f5ab - middle::trans::consts::trans_const::h943a0d0f09546997mmk::v0.11.pre
  20:        0x1098c191c - middle::trans::base::trans_item::hc7d767359a0a6854alp::v0.11.pre
  21:        0x1099b27d1 - middle::trans::base::trans_mod::h8117792907f7df90gqp::v0.11.pre
  22:        0x1099bbcde - middle::trans::base::trans_crate::h2327afe0ee1ba3fcB5p::v0.11.pre
  23:        0x10a0c12c8 - driver::driver::phase_4_translate_to_llvm::hdf0bb46be69d2d70qjf::v0.11.pre
  24:        0x10a0c4a3f - driver::driver::compile_input::h14a3bf94d25e191eHAf::v0.11.pre
  25:        0x10a0ead87 - run_compiler::hc95fb7c1be5fbe20l4m::v0.11.pre
  26:        0x10a102cdd - main_args::closure.91009
  27:        0x10a101072 - monitor::closure.90884
  28:        0x10a0fbc5b - task::TaskBuilder::try::closure.90650
  29:        0x10987ad6c - task::spawn_opts::closure.7136
  30:        0x10c5d2b78 - rt::task::Task::run::closure.40346
  31:        0x10c5e1d5c - rust_try
  32:        0x10c5d29f7 - rt::task::Task::run::h3856271866f0131dC57::v0.11.pre
  33:        0x10987abef - task::spawn_opts::closure.7108
  34:        0x10c5db546 - rt::thread::thread_start::h83a23077bc99beefPK8::v0.11.pre
  35:     0x7fff92309899 - _pthread_body
  36:     0x7fff9230972a - _pthread_struct_init


@Twisol
Copy link

Twisol commented Jan 4, 2015

/cc @eddyb

@steveklabnik
Copy link
Member

This sample now compiles for me without issue.

flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 1, 2022
manual_let_else: keep macro call on suggestion blocks

Closes rust-lang#9940

changelog: [`manual_let_else`]: Do not expand macro calls on suggestions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants