-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
non_local_definitions lint is unhappy with multiple nested anonymous constants #131474
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.L-non_local_definitionsLint: non_local_definitionsLint: non_local_definitionsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.L-non_local_definitionsLint: non_local_definitionsLint: non_local_definitionsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code:
This should be completely okay, since the impl is only nested within anonymous constant blocks.
Instead, you get this backwards-compatibility warning:
Meta
rustc --version --verbose:This is currently affecting the
bevy_reflectcrate, which has a few instances of doubly-nested anonymous constants generated by macros. Particularly, theimpl_type_path!macro nests its result in an anonymous constant, and theimpl_reflect_for_atomic!calls this macro inside an anonymous constant. The anonymous constants exist to allow local imports without affecting the larger scope.