Skip to content

Missing edge-case when destructuring #1261

@Diggsey

Description

@Diggsey

AFAICT it's currently impossible to destructure a &T into a mut T (which should be possible when T is Copy).

eg.

let &foo = &1;
foo = 2; // Cannot mutate foo

a)

let &mut foo = &1; // Will not compile
foo = 2;

b)

let &(mut foo) = &1; // Will not compile
foo = 2;

c)

let mut &foo = &1; // Will not compile
foo = 2;

d)

let & mut foo = &1; // Will not compile
foo = 2;

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions