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

Nightly compiler error regression for struct array field #40749

Closed
nickbabcock opened this Issue Mar 22, 2017 · 2 comments

Comments

Projects
None yet
4 participants
@nickbabcock
Copy link
Contributor

nickbabcock commented Mar 22, 2017

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,})))`
@arielb1

This comment has been minimized.

Copy link
Contributor

arielb1 commented Mar 23, 2017

Also in beta=1.17.

@brson brson added the I-ICE label Mar 23, 2017

@nikomatsakis

This comment has been minimized.

@brson brson added the P-high label Mar 23, 2017

arielb1 added a commit to arielb1/rust that referenced this issue Mar 23, 2017

keep the AST node-id when lowering ExprKind::Range
When the Range expression is the root of a constant, its node-id is
used for the def-id of the body, so it has to be preserved in the AST ->
HIR lowering.

Fixes rust-lang#40749.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 25, 2017

Rollup merge of rust-lang#40764 - arielb1:range-nodes, r=eddyb
keep the AST node-id when lowering ExprKind::Range

When the Range expression is the root of a constant, its node-id is
used for the def-id of the body, so it has to be preserved in the AST ->
HIR lowering.

Fixes rust-lang#40749.

r? @eddyb
beta-nominating because regression

bors added a commit that referenced this issue Mar 25, 2017

Auto merge of #40764 - arielb1:range-nodes, r=eddyb
keep the AST node-id when lowering ExprKind::Range

When the Range expression is the root of a constant, its node-id is
used for the def-id of the body, so it has to be preserved in the AST ->
HIR lowering.

Fixes #40749.

r? @eddyb
beta-nominating because regression

bors added a commit that referenced this issue Mar 25, 2017

Auto merge of #40764 - arielb1:range-nodes, r=eddyb
keep the AST node-id when lowering ExprKind::Range

When the Range expression is the root of a constant, its node-id is
used for the def-id of the body, so it has to be preserved in the AST ->
HIR lowering.

Fixes #40749.

r? @eddyb
beta-nominating because regression

bors added a commit that referenced this issue Mar 27, 2017

Auto merge of #40764 - arielb1:range-nodes, r=eddyb
keep the AST node-id when lowering ExprKind::Range

When the Range expression is the root of a constant, its node-id is
used for the def-id of the body, so it has to be preserved in the AST ->
HIR lowering.

Fixes #40749.

r? @eddyb
beta-nominating because regression

@bors bors closed this in #40764 Mar 27, 2017

arielb1 added a commit to arielb1/rust that referenced this issue Apr 2, 2017

keep the AST node-id when lowering ExprKind::Range
When the Range expression is the root of a constant, its node-id is
used for the def-id of the body, so it has to be preserved in the AST ->
HIR lowering.

Fixes rust-lang#40749.

arielb1 added a commit to arielb1/rust that referenced this issue Apr 2, 2017

keep the AST node-id when lowering ExprKind::Range
When the Range expression is the root of a constant, its node-id is
used for the def-id of the body, so it has to be preserved in the AST ->
HIR lowering.

Fixes rust-lang#40749.

arielb1 added a commit to arielb1/rust that referenced this issue Apr 2, 2017

keep the AST node-id when lowering ExprKind::Range
When the Range expression is the root of a constant, its node-id is
used for the def-id of the body, so it has to be preserved in the AST ->
HIR lowering.

Fixes rust-lang#40749.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.