Skip to content

Conversation

@A4-Tacks
Copy link
Member

Example

struct S { field: (i32, i32) }
fn main() {
    let S { $0field } = S { field: (2, 3) };
    let v = field.0 + field.1;
}

Before this PR:

struct S { field: (i32, i32) }
fn main() {
    let S { ($0_0, _1) } = S { field: (2, 3) };
    let v = _0 + _1;
}

After this PR:

struct S { field: (i32, i32) }
fn main() {
    let S { field: ($0_0, _1) } = S { field: (2, 3) };
    let v = _0 + _1;
}

Example
---
```rust
struct S { field: (i32, i32) }
fn main() {
    let S { $0field } = S { field: (2, 3) };
    let v = field.0 + field.1;
}
```

**Before this PR**:

```rust
struct S { field: (i32, i32) }
fn main() {
    let S { ($0_0, _1) } = S { field: (2, 3) };
    let v = _0 + _1;
}
```

**After this PR**:

```rust
struct S { field: (i32, i32) }
fn main() {
    let S { field: ($0_0, _1) } = S { field: (2, 3) };
    let v = _0 + _1;
}
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 20, 2025
Copy link
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Veykril Veykril added this pull request to the merge queue Oct 26, 2025
Merged via the queue into rust-lang:master with commit 036ab60 Oct 26, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 26, 2025
@lnicola lnicola changed the title Fix shorthand field pat for destructure_tuple_binding fix: handle shorthand field patterns in destructure_tuple_binding Oct 26, 2025
@A4-Tacks A4-Tacks deleted the destruct-tuple-shorthand branch October 26, 2025 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants