Skip to content

ReStatic ICE with nll and thread_local #51269

@robsmith11

Description

@robsmith11

I'm getting a ICE when compiling my crate with the current nightly. This minimal example reproduces it:

#![feature(nll)] #![feature(thread_local)] #[thread_local] static mut X1:u64 = 0; struct S1 { a:&'static mut u64, } impl S1 { fn new(_x:u64) -> S1 { S1 { a:unsafe { &mut X1 } } } } fn main() { S1::new(0).a; } 
error: internal compiler error: unexpected region for local data ReStatic --> src/main.rs:12:30 | 12 | S1 { a:unsafe { &mut X1 } } | 

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-needs-decisionIssue: In need of a decision.NLL-soundWorking towards the "invalid code does not compile" goal

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions