Skip to content

fix: Not suggest name in nested type in variant#21927

Merged
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
A4-Tacks:no-expect-name-nested
Apr 3, 2026
Merged

fix: Not suggest name in nested type in variant#21927
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
A4-Tacks:no-expect-name-nested

Conversation

@A4-Tacks
Copy link
Copy Markdown
Member

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

Partial of #21892

Example

struct Other;
struct Vec<T>(T);
enum Foo {
    Vec(Vec<$0>)
}

Before this PR

st Vec<…> Vec<{unknown}> [name]
en Foo Foo []
st Other Other []
sp Self Foo []

After this PR

en Foo Foo []
st Other Other []
sp Self Foo []
st Vec<…> Vec<{unknown}> []

Example
---
```rust
struct Other;
struct Vec<T>(T);
enum Foo {
    Vec(Vec<$0>)
}
```

**Before this PR**

```text
st Vec<…> Vec<{unknown}> [name]
en Foo Foo []
st Other Other []
sp Self Foo []
```

**After this PR**

```text
en Foo Foo []
st Other Other []
sp Self Foo []
st Vec<…> Vec<{unknown}> []
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 1, 2026
ast::Variant(it) => {
let is_simple_field = |field: ast::TupleField| {
let Some(ty) = field.ty() else { return true };
matches!(ty, ast::Type::PathType(_)) && ty.generic_arg_list().is_none()
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.

This will mean we'll also not suggest on Foo($0<>); do you think we should suggest on that?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think it's necessary, this kind of completion is rare

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Apr 3, 2026
Merged via the queue into rust-lang:master with commit 671ba41 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 no-expect-name-nested branch April 3, 2026 02:48
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