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: "Error constructed but not emitted" #41367

Closed
deepinthebuild opened this issue Apr 18, 2017 · 1 comment
Closed

ICE: "Error constructed but not emitted" #41367

deepinthebuild opened this issue Apr 18, 2017 · 1 comment

Comments

@deepinthebuild
Copy link
Contributor

deepinthebuild commented Apr 18, 2017

This code gives an ICE when compiled on latest nightly on MSVC:

struct Foo {
    s: usize,
    f: bool
}
impl Foo {
    fn bar(&self, position: (usize, usize)) -> Vec<(usize, usize)> {
      let s = self.s;
      let mut output = Vec::with_capacity(s * s);
      for t in 0..s*s {
        let offset = (t / s, t % s)
        let coordinate = (position.0 + offset.0, position.1 + offset.1);
        output.push(coordinate);
      }

      output
    }
}

Resulting in:

error: expected one of `.`, `;`, `?`, or an operator, found `let`
  --> <anon>:12:9
   |
11 |         let offset = (t / s, t % s)
   |                                    - expected one of `.`, `;`, `?`, or an operator here
12 |         let coordinate = (position.0 + offset.0, position.1 + offset.1);
   |         ^^^ unexpected token

error: internal compiler error: Error constructed but not emitted
error: internal compiler error: unexpected panic

rustc --version --verbose
rustc 1.18.0-nightly (7627e3d31 2017-04-16) binary: rustc commit-hash: 7627e3d31dd641ae9042675e9032857f58d0c5d1 commit-date: 2017-04-16 host: x86_64-pc-windows-msvc release: 1.18.0-nightly LLVM version: 3.9

Possibly already resolved with #41161 ?

@arielb1
Copy link
Contributor

arielb1 commented Apr 18, 2017

No ICE in newer rustcs, albeit sucky error recovery:

error: expected one of `.`, `;`, `?`, or an operator, found `let`
  --> fail.rs:11:9
   |
10 |         let offset = (t / s, t % s)
   |                                    - expected one of `.`, `;`, `?`, or an operator here
11 |         let coordinate = (position.0 + offset.0, position.1 + offset.1);
   |         ^^^ unexpected token

error: missing `fn`, `type`, or `const` for impl-item declaration
  --> fail.rs:13:8
   |
13 |         }
   |  ________^ starting here...
14 | |
15 | |       output
   | |______^ ...ending here: missing `fn`, `type`, or `const`

error: expected item, found `}`
  --> fail.rs:17:1
   |
17 | }
   | ^

error: aborting due to previous error

@arielb1 arielb1 closed this as completed Apr 18, 2017
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

2 participants