Skip to content

ICE: "Error constructed but not emitted" #41367

Closed
@deepinthebuild

Description

@deepinthebuild

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions