-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking Issue for RFC 3373: Avoid non-local definitions in functions #120363
Copy link
Copy link
Closed
Labels
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCL-non_local_definitionsLint: non_local_definitionsLint: non_local_definitionsT-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCL-non_local_definitionsLint: non_local_definitionsLint: non_local_definitionsT-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Idea
This is a tracking issue for the RFC 3373: Avoid non-local definitions in functions (rust-lang/rfcs#3373).
Summary
Add a warn-by-default lint for items inside functions or expressions that implement methods or traits that are visible outside the function or expression.
About tracking issues
Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
Stabilization PR (see instructions on rustc-dev-guide)Unresolved questions
constitems as well, or would that produce unwanted warnings?const _: () = { /* .. */ }since the pattern is widely used in the ecosystem, includingserde_derive.Related
non_local_definitionscommon issues: impl for&Local,From<Local> for Global, ... #121621 (comment)non-local-definitionslint #124396non_local_definitionslint fires forimpl Trait for NonLocalType<SomeLocalType>, probably shouldn't #126768non_local_definitionslint to allow-by-default #127015non_local_definitionslint to only use a syntactic heuristic #127117