Skip to content

fix: add naming convention validation for union types#21794

Merged
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
Albab-Hasan:fix/union-naming-validation
Mar 11, 2026
Merged

fix: add naming convention validation for union types#21794
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
Albab-Hasan:fix/union-naming-validation

Conversation

@Albab-Hasan
Copy link
Contributor

the non_camel_case_types and non_snake_case lints were not applied to union items by rust-analyzer. rustc applies these lints to unions the same way it does to structs and enums. this adds validate_union and validate_union_fields to DeclValidator. the repr(C) exemption is included to match rustc behavior. IdentType::Union is added to produce the correct diagnostic message.

generated with ai assistance (claude sonnet 4.6).
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 10, 2026
Copy link
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.

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Mar 11, 2026
Merged via the queue into rust-lang:master with commit 8ed3cca Mar 11, 2026
17 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 11, 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.

3 participants