Skip to content

Comments

feat: offer destructure_struct_binding on self param#21687

Open
A4-Tacks wants to merge 1 commit intorust-lang:masterfrom
A4-Tacks:destruct-self-param
Open

feat: offer destructure_struct_binding on self param#21687
A4-Tacks wants to merge 1 commit intorust-lang:masterfrom
A4-Tacks:destruct-self-param

Conversation

@A4-Tacks
Copy link
Member

@A4-Tacks A4-Tacks commented Feb 21, 2026

Close #20869

Example

struct Foo { bar: i32, baz: i32 }

impl Foo {
    fn foo(&mut $0self) {
        self.bar = 5;
    }
}

Before this PR

Assist not applicable

After this PR

struct Foo { bar: i32, baz: i32 }

impl Foo {
    fn foo(&mut self) {
        let Foo { bar, baz } = self;
        *bar = 5;
    }
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 21, 2026
Example
---
```rust
struct Foo { bar: i32, baz: i32 }

impl Foo {
    fn foo(&mut $0self) {
        self.bar = 5;
    }
}
```

**Before this PR**

Assist not applicable

**After this PR**

```rust
struct Foo { bar: i32, baz: i32 }

impl Foo {
    fn foo(&mut self) {
        let Foo { bar, baz } = self;
        *bar = 5;
    }
}
```
@A4-Tacks A4-Tacks force-pushed the destruct-self-param branch from c98d005 to 9686a46 Compare February 21, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow “Destructure struct binding” for self

2 participants