-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking issue for future-incompatibility lint elided_lifetimes_in_associated_constant #115010
Copy link
Copy link
Open
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-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-future-incompatibilityCategory: Future-incompatibility lintsCategory: Future-incompatibility lintsC-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 RFCT-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-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Milestone
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-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-future-incompatibilityCategory: Future-incompatibility lintsCategory: Future-incompatibility lintsC-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 RFCT-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-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
This is a tracking issue for the
elided_lifetimes_in_associated_constantfuture-incompatibility lint.The goal of this page is describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made. For more information on the policy around future-compatibility warnings, see our breaking change policy guidelines.
What
The
elided_lifetimes_in_associated_constantlint detects elided lifetimes that became erroneously allowed in associated constants after #97313.They current desugar to fresh early-bound lifetimes on the parent impl, like:
This is in contrast to the way that elided lifetimes are treated in item-level consts (where elided lifetimes are resolved to
'static), and this behavior was also never formally decided -- static-in-const lifetime rules do not apply to associated consts (rust-lang/rfcs#1623 (comment), #38831 (comment)).Why
It was never decided what to do with elided lifetimes in consts, and it is not clear that the current behavior is optimal here. This is to stop the leaking by making sure existing elided lifetimes are fixed back to using
'staticas they were required to before version 1.64, and that new usages of elided lifetimes in consts are not introduced.How to fix
Replace the elided lifetimes with
'static(or manually introduce or reference another lifetime):Tracking
ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT) #115011elided_lifetimes_in_associated_constantto deny #124211