Skip to content

fix: Fix param inlayHints on empty expr and comma#21926

Merged
ChayimFriedman2 merged 2 commits intorust-lang:masterfrom
A4-Tacks:inlayhint-empty-arg
Apr 3, 2026
Merged

fix: Fix param inlayHints on empty expr and comma#21926
ChayimFriedman2 merged 2 commits intorust-lang:masterfrom
A4-Tacks:inlayhint-empty-arg

Conversation

@A4-Tacks
Copy link
Copy Markdown
Member

@A4-Tacks A4-Tacks commented Apr 1, 2026

Example

pub fn test(a: i32, b: i32, c: i32) {}
fn main() {
    test(, 2,);
    test(, , 3);
}

Before this PR

    test(, 2,);
         //^ a
    test(, , 3);
           //^ a

After this PR

    test(, 2,);
         //^ b
    test(, , 3);
           //^ c

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 1, 2026
@A4-Tacks A4-Tacks changed the title inlayhint empty arg fix: Fix param inlayHints on empty expr and comma Apr 1, 2026
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

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

One minor nit, then LGTM.

View changes since this review

}

/// Comma separated args, argument may be empty
pub fn split_args(args: &ast::ArgList) -> impl Iterator<Item = Option<ast::Expr>> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I prefer this to be a method in syntax.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also a more descriptive name, like args_maybe_empty().

Copy link
Copy Markdown
Member Author

@A4-Tacks A4-Tacks Apr 3, 2026

Choose a reason for hiding this comment

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

I don't think we should accept &SyntaxNode because he only handles ArgList

Oh, it's syntax crate

A4-Tacks added 2 commits April 3, 2026 15:28
Example
---
```rust
pub fn test(a: i32, b: i32, c: i32) {}
fn main() {
    test(, 2,);
    test(, , 3);
}
```

**Before this PR**

```rust
    test(, 2,);
         //^ a
    test(, , 3);
           //^ a
```

**After this PR**

```rust
    test(, 2,);
         //^ b
    test(, , 3);
           //^ c
```
@A4-Tacks A4-Tacks force-pushed the inlayhint-empty-arg branch from 6422bd2 to dff1339 Compare April 3, 2026 07:28
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 3, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Apr 3, 2026
Merged via the queue into rust-lang:master with commit 5f147cc Apr 3, 2026
17 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 3, 2026
@A4-Tacks A4-Tacks deleted the inlayhint-empty-arg branch April 3, 2026 08:01
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