Skip to content

Nightly compiler error regression for struct array field #40749

Closed
@nickbabcock

Description

@nickbabcock

The following code produces a compiler error (as expected) on stable, but the compiler crashes on nightly.

pub struct ChunkIterator {
    buf: [u8; 10],
}

impl ChunkIterator {
    pub fn new() {
        ChunkIterator {
            buf: [0; ..10],
        }
    }
}

On stable:

error[E0308]: mismatched types
 --> <anon>:8:22
  |
8 |             buf: [0; ..10],
  |                      ----
  |                      |
  |                      expected usize, found struct `std::ops::RangeTo`
  |                      in this macro invocation
  |
  = note: expected type `usize`
             found type `std::ops::RangeTo<{integer}>`

On nightly:

error: internal compiler error: /checkout/src/librustc/hir/map/mod.rs:379: local_def_id: no entry for `22`, which has a map of `Some(EntryExpr(NodeId(20), expr(22: ::std::ops::RangeTo{end: 10,})))`

Metadata

Metadata

Assignees

Labels

I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions