Skip to content

ICE: In function receiving a boxed Invoke: 'rustc' panicked at 'assertion failed: !ty::type_needs_infer(ty)' #19919

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
Munksgaard opened this issue Dec 16, 2014 · 2 comments

Comments

@Munksgaard
Copy link
Contributor

The following code results in an internal compiler error:

#![feature(default_type_params)]

use std::thunk::Invoke;

fn foo(x: Box<for <'a>Invoke<&'a int, ()>>) {
}

fn bar() {
    foo( box () (move |: _| () ))
}

fn main() {
}

Compiler output:

$ RUST_BACKTRACE=1 rustc foo.rs
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'assertion failed: !ty::type_needs_infer(ty)', /home/munksgaard/src/rust/src/librustc_typeck/
lib.rs:131                                                                                                           

stack backtrace:
   1:     0x7f87b8a7dcf0 - rt::backtrace::imp::write::h645bafd98e8e710ffVx
   2:     0x7f87b8a810c0 - failure::on_fail::hadfa9c4bd89befdeImy
   3:     0x7f87b86c05d0 - unwind::begin_unwind_inner::hb7b66784235a0c45zNc
   4:     0x7f87b7c4e200 - unwind::begin_unwind::h6432056029046382294
   5:     0x7f87b7c77a50 - write_ty_to_tcx::h531c5306c5a4ce51HFy
   6:     0x7f87b7c6f870 - check::writeback::WritebackCx<'cx, 'tcx>::visit_node_id::he6b1ea82aefc9e13rZb
   7:     0x7f87b7c69180 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h2e5bb818aa1baec7SOb
   8:     0x7f87b7c69180 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h2e5bb818aa1baec7SOb
   9:     0x7f87b7d3cd40 - check::check_bare_fn::h47fbea7c0e66b231Pbk
  10:     0x7f87b7d348d0 - check::check_item::haae896fdd12b9182fvk
  11:     0x7f87b7f8c6d0 - check_crate::unboxed_closure.42749
  12:     0x7f87b7f873e0 - check_crate::h7f1d4273943762142Wy
  13:     0x7f87b8ed0530 - driver::phase_3_run_analysis_passes::h9674b56be39567edEta
  14:     0x7f87b8eb3950 - driver::compile_input::ha2f50471fb032db2rba
  15:     0x7f87b90677f0 - run_compiler::h6ae6cbe07908d3f9AYb
  16:     0x7f87b905e430 - thunk::F.Invoke<A, R>::invoke::h13189201362017435713
  17:     0x7f87b8a560a0 - thunk::F.Invoke<A, R>::invoke::h392198810864924209
  18:     0x7f87b86bed40 - task::Task::spawn_thunk::closure.5776
  19:     0x7f87b871dd20 - rust_try_inner
  20:     0x7f87b871dd10 - rust_try
  21:     0x7f87b86bee50 - unwind::try::h9da252fcf57eda5bQCc
  22:     0x7f87b86bebe0 - task::Task::run::ha8da221d1b1071efRNb
  23:     0x7f87b86be350 - thunk::F.Invoke<A, R>::invoke::h1465999670317872655
  24:     0x7f87b86bfca0 - thread::thread_start::hbb38abc3a96b7cc5b5b
  25:     0x7f87b34c7160 - start_thread
  26:     0x7f87b839dc69 - __clone
  27:                0x0 - <unknown>
$ rustc --version
rustc 0.13.0-dev (126db549b 2014-12-15 00:07:35 +0000)
@Munksgaard
Copy link
Contributor Author

To clarify, this works fine with rust 0.12:

fn foo(x: proc(&int)) {
}

fn bar() {
    foo(proc(_)())
}

fn main() {
}
$ rustc-0.12.0 --version
rustc 0.12.0-dev

@Munksgaard
Copy link
Contributor Author

These errors stopped appearing sometime in the last couple of weeks. The code above compiles when the boxed closure is explicitly typed as such:

#![feature(default_type_params)]

use std::thunk::Invoke;

fn foo(x: Box<for <'a>Invoke<&'a int, ()>>) {
}

fn bar() {
    foo( box () (move |: _: &int| () ))
}

fn main() {
}

However, without the explicit type declaration, it produces some rather weird type errors. I've created a new issue (#20528) to fix this, and am now closing this as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant