Skip to content

error: internal compiler error: /checkout/src/librustc_borrowck/borrowck/mod.rs:808: aliasability violation for static cannot borrow data mutably #42344

Closed
@Ekleog

Description

@Ekleog

When compiling the following code, with rustc (nightly, beta or stable at the moment):

static TAB: [&mut [u8]; 0] = [];
pub unsafe fn test() {
    TAB[0].iter_mut();
}
pub fn main() {}

I get the following error:

error: internal compiler error: /checkout/src/librustc_borrowck/borrowck/mod.rs:808: aliasability violation for static `cannot borrow data mutably`

Here is the relevant playground link: https://is.gd/42slwV

Hope that helps,
Leo

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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