Skip to content

Conversation

A4-Tacks
Copy link
Contributor

@A4-Tacks A4-Tacks commented Oct 7, 2025

Example

fn foo() {
    bar(|| $0);
}
fn bar(f: impl FnOnce() -> u32) {}

Before this PR:

ty: impl FnOnce() -> u32, name: ?

After this PR:

ty: u32, name: ?

Example
---
```rust
fn foo() {
    bar(|| $0);
}
fn bar(f: impl FnOnce() -> u32) {}
```

**Before this PR**:

```
ty: impl FnOnce() -> u32, name: ?
```

**After this PR**:

```
ty: u32, name: ?
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 7, 2025
.unwrap_or((None, None))
},
ast::ParamList(_) => (None, None),
ast::ParamList(it) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it inside a ParamList? Couldn't this degrade completions for some other cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why is it inside a ParamList?

When completing || $0, the token is | and token.parent() is the ParamList

Couldn't this degrade completions for some other cases?

The difference should only be when ParamList is used as a closure parameter, because .and_then(ast::ClosureExpr::cast)

Copy link
Contributor

Choose a reason for hiding this comment

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

But won't it also trigger when inside the param list, e.g. |$0| ...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But won't it also trigger when inside the param list, e.g. |$0| ...?

Will expected_type_and_name be called when completing this case?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, not sure.

@A4-Tacks A4-Tacks closed this Oct 10, 2025
@A4-Tacks A4-Tacks deleted the empty-closure-analysis branch October 10, 2025 04:43
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 10, 2025
@A4-Tacks
Copy link
Contributor Author

Sorry, there was a problem with rebase.

Please move to step #20824

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