Skip to content

ICE when assigning to a static mut #47789

Closed
@nikomatsakis

Description

@nikomatsakis

This code assigning to a static mut causes an ICE when run with feature(nll):

#![feature(nll)]

static y: u32 = 22;
static mut x: &'static u32 = &y;

fn foo() {
    unsafe { x = &y; }
}

fn main() { }

On the playground, I get this:

error: internal compiler error: unexpected panic

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.25.0-nightly (9fd7da904 2018-01-25) running on x86_64-unknown-linux-gnu

thread 'rustc' panicked at 'internal error: entered unreachable code', librustc_mir/dataflow/impls/borrows.rs:400:50
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)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

Relationships

None yet

Development

No branches or pull requests

Issue actions