Skip to content

ICE when initiating an array using static for size #16382

@anmej

Description

@anmej
static SIZE: int = 25;

fn main() {
    let mut map: [int, ..SIZE as uint] = [1, ..SIZE as uint];
}

This produces the following message:

error: internal compiler error: node_id_to_type: no type for node `expr SIZE (id=17)`
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>', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/ast_util.rs:784

This, hovewer, works:

static SIZE: uint = 25;

fn main() {
    let mut map: [int, ..SIZE] = [1, ..SIZE];
}

rustc version: 0.12.0-pre-nightly (7be8f0a 2014-08-07 02:26:07 +0000)
OS: Mac OS X 10.9.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions