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

ICE - ReInfer left in a type when using closures #17636

Closed
arielb1 opened this issue Sep 29, 2014 · 0 comments · Fixed by #18099
Closed

ICE - ReInfer left in a type when using closures #17636

arielb1 opened this issue Sep 29, 2014 · 0 comments · Fixed by #18099
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-type-system Area: Type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@arielb1
Copy link
Contributor

arielb1 commented Sep 29, 2014

The following code (seems minimal) ICEs:

trait MyItem<T> {} 
impl<T> MyItem<T> for T {}

pub fn build_archive<'a, I: MyItem<&'a (|&uint|:'a)>>(files: I) {}

fn main() {
  build_archive(&(|_| { }));
}

with the following error

error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. 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' failed at 'assertion failed: !ty::type_needs_infer(ty)', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc/middle/typeck/mod.rs:287

stack backtrace:
1: 0x7f589d110740 - rt::backtrace::imp::write::heebf58b6ac691aa6vUq
2: 0x7f589d113900 - failure::on_fail::h204692c9d758e6bbXfr
3: 0x7f58a18112d0 - unwind::begin_unwind_inner::h5df2dc6f14b19f71MTd
4: 0x7f58a1e58dd0 - unwind::begin_unwind::h1137722113218807222
5: 0x7f58a237e120 - middle::typeck::write_ty_to_tcx::h340434295f08522e9Cj
6: 0x7f58a237b180 - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>::visit_node_id::h2f07137fb6ba1caenvL
7: 0x7f58a23792a0 - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h1b9edac22fa294eenkL
8: 0x7f58a23792a0 - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h1b9edac22fa294eenkL
9: 0x7f58a237ac90 - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_block::h636f3cf043625202KlL
10: 0x7f58a237aad0 - middle::typeck::check::writeback::resolve_type_vars_in_fn::h2b973af1fdf4e8b0DfL
11: 0x7f58a23c8cc0 - middle::typeck::check::check_bare_fn::h1bff9ee5f4e84535f9R
12: 0x7f58a23c4a50 - middle::typeck::check::check_item::h1c01578942bc4bfaiBS
13: 0x7f58a23c8770 - middle::typeck::check::check_item_types::hbc5ac40f3d3cae1ap8R
14: 0x7f58a1e774b0 - util::common::time::h5723798609349898350
15: 0x7f58a266fad0 - middle::typeck::check_crate::h5732ccea6ca40e95FVj
16: 0x7f58a26d9600 - driver::driver::phase_3_run_analysis_passes::h5c6d0a55804972d1pqw
17: 0x7f58a26d4d50 - driver::driver::compile_input::hd84cb07887cabc36m7v
18: 0x7f58a2757000 - driver::run_compiler::h0b16c0ac7a7e28ceeXz
19: 0x7f58a2756ee0 - driver::main_args::closure.145992
20: 0x7f58a1e905f0 - task::TaskBuilder<S>::try_future::closure.101285
21: 0x7f58a1e903e0 - task::TaskBuilder<S>::spawn_internal::closure.101256
22: 0x7f58a1b60650 - task::spawn_opts::closure.8485
23: 0x7f58a1867480 - rust_try_inner
24: 0x7f58a1867470 - rust_try
25: 0x7f58a180e910 - unwind::try::h8c8d3e6eb0ca16a6uId
26: 0x7f58a180e770 - task::Task::run::hfb873359c59e1424cYc
27: 0x7f58a1b603c0 - task::spawn_opts::closure.8425
28: 0x7f58a1810360 - thread::thread_start::h2b0150e66287e12frid
29: 0x7f589c4bcfe0 - start_thread
30: 0x7f58a14e0bf9 - __clone
31: 0x0 - <unknown>

The issue seems to be a ReInfer left in a type, and it seems to be related to an heisenbug that me and eddyb faced while refactoring ty::t.

The issue seems to be present at least in versions 2550243 to 1f3cda8, but play.rust-lang.org's Rust 0.11 seems to return a (seemingly wrong) type error instead of ICE'ing:
error: cannot determine a type for this bounded type parameter: unconstrained type.

@kmcallister kmcallister added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-diagnostics Area: Messages for errors, warnings, and lints A-type-system Area: Type system labels Sep 30, 2014
@ghost ghost added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 11, 2014
bors added a commit that referenced this issue Oct 18, 2014
Closes #9249.
Closes #13105.
Closes #13837.
Closes #13847.
Closes #15207.
Closes #15261.
Closes #16048. 
Closes #16098.
Closes #16256.
Closes #16562.
Closes #16596.
Closes #16709.
Closes #16747.
Closes #17025.
Closes #17121.
Closes #17450.
Closes #17636.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-type-system Area: Type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants