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 on for n in [1, 2, 3].iter() if the type of 1, 2, 3 cannot be inferred #15984

Closed
apoelstra opened this issue Jul 25, 2014 · 1 comment
Closed
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@apoelstra
Copy link
Contributor

The following program ICE's on the playpen (will update to git HEAD and check there):

fn main() {
  for n in [1, 2, 3, 4].iter() {}
}

If you remove the for loop it is better, it will say "please add a suffix to 1" or something like that. (Maybe this was fixed by the recent changes in the for loop implementation?)

Exact ICE is

anon>:17:18: 17:27 error: internal compiler error: borrow-vec associated with bad sty: &ty_err
<anon>:17         for n in [1, 2, 3].iter() { }
                           ^~~~~~~~~
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 'Box<Any>', /build/rust-git/src/rust/src/libsyntax/ast_util.rs:784

Edit: The new for loop changes allow the above program to compile. But you can still access the bug with

fn main() {
  let x = [1, 2, 3, 4].iter();
}

which ICEs even with git HEAD. (Above I said "if you remove the for loop it doesn't crash" but evidently I was wrong.)

@ghost
Copy link

ghost commented Aug 13, 2014

Duplicate of #7813.

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

2 participants