-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Use a default lifetime of 'static in associated consts #125190
Copy link
Copy link
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language teamdisposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language teamdisposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Expand the interpretation of rust-lang/rfcs#1623 "static_lifetime_in_statics" to include associated consts in traits and trait impls when there are no other lifetimes in scope. This means the following code will compile:
However, if there are any lifetime parameters on the item declaration or const, we will continue to require an explicit choice of lifetime. We may revisit this decision in the future. Examples are listed in the appendix below.
Rationale: There is a high level of churn suggested by the backreferences to #115010. The primary intention of this FCP is to reduce the churn associated with this change. The lang team discussed #124211 and thought it would be good to decide on what we want in the most obvious (and common) cases, which should also reduce the level of churn significantly.
Appendix: Examples with lifetimes