Use a default lifetime of 'static
in associated consts
#125190
Labels
A-associated-items
Area: Associated items such as associated types and consts.
A-lifetimes
Area: lifetime related
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
disposition-merge
This issue / PR is in PFCP or FCP with a disposition to merge it.
finished-final-comment-period
The final comment period is finished for this PR / Issue.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
to-announce
Announce this issue on triage meeting
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
The text was updated successfully, but these errors were encountered: