Skip to content

ICE when referencing () from an array #43205

Closed
@goffrie

Description

@goffrie

This code:

fn main() {
    println!("{:?}", &[()][0]);
}

gives this ICE:

error: internal compiler error: /checkout/src/librustc_trans/mir/lvalue.rs:301: using operand local _10 as lvalue

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.20.0-nightly (f85579d4a 2017-07-12) running on x86_64-unknown-linux-gnu

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:489:8

playground

Doesn't happen if you use e.g. 1 instead of (), or use (&[()]) instead of [()].

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions