Skip to content

fix: complete variants of hidden enums through public aliases#22003

Merged
A4-Tacks merged 1 commit intorust-lang:masterfrom
Amit5601:fix/hidden-enum-clean
Apr 13, 2026
Merged

fix: complete variants of hidden enums through public aliases#22003
A4-Tacks merged 1 commit intorust-lang:masterfrom
Amit5601:fix/hidden-enum-clean

Conversation

@Amit5601
Copy link
Copy Markdown
Contributor

@Amit5601 Amit5601 commented Apr 9, 2026

Fixes #21891.

Previously, the completion engine would aggressively bail out if the parent enum was marked . This pushes the visibility check down to the individual variants so they can be properly completed when accessed via a public type alias.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 9, 2026
Comment thread crates/ide-completion/src/tests/item.rs Outdated
pub type Bar = Foo;

fn main() {
let x = Bar::V$0;
Copy link
Copy Markdown
Member

@A4-Tacks A4-Tacks Apr 12, 2026

Choose a reason for hiding this comment

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

View changes since the review

This test is invalid, you need to reference it in another crate

}
e.variants(ctx.db)
.into_iter()
.filter(|&variant| ctx.check_stability_and_hidden(variant))
Copy link
Copy Markdown
Member

@A4-Tacks A4-Tacks Apr 12, 2026

Choose a reason for hiding this comment

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

View changes since the review

This check is redundant, it already exists in add_enum_variant

Fixes rust-lang#21891.

Previously, the completion engine would aggressively bail out if the parent enum was marked . This pushes the visibility check down to the individual variants so they can be properly completed when accessed via a public type alias.
@Amit5601 Amit5601 force-pushed the fix/hidden-enum-clean branch from 6685b15 to 9704b3f Compare April 13, 2026 15:26
@Amit5601 Amit5601 requested a review from A4-Tacks April 13, 2026 15:36
@A4-Tacks A4-Tacks added this pull request to the merge queue Apr 13, 2026
Merged via the queue into rust-lang:master with commit b917d70 Apr 13, 2026
17 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 13, 2026
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.

Cannot complete variant in hidden enum alias

3 participants