-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Mention infer_static_outlives_requirements removal
#3278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
infer_static_outlives_requirements removal
|
@rustbot label not-rfc |
|
We discussed this pull request during @rust-lang/internal-sites triage of non-RFC PRs in #t-internal-sites > Stale non-RFC PRs @ 💬. We consider that while this PR is not an RFC, it still falls through the responsibility of T-lang. Therefore cc-ing them. @rustbot labels +T-lang +I-lang-nominated |
text/2093-infer-outlives.md
Outdated
| # This RFC was previously approved, but part of it later **withdrawn** | ||
|
|
||
| To infer `T: 'static` requirements from structs, the `infer_static_outlives_requirements` feature was previously implemented | ||
| as part of this RFC, but later removed. For details see the [summary comment]. | ||
|
|
||
| [summary comment]: https://github.com/rust-lang/rust/issues/54185#issuecomment-1124097663 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # This RFC was previously approved, but part of it later **withdrawn** | |
| To infer `T: 'static` requirements from structs, the `infer_static_outlives_requirements` feature was previously implemented | |
| as part of this RFC, but later removed. For details see the [summary comment]. | |
| [summary comment]: https://github.com/rust-lang/rust/issues/54185#issuecomment-1124097663 | |
| # This RFC was modified after it was accepted | |
| As implemented, the compiler will automatically add where-clauses of the form `where T: 'x` when (a) `'x` is a lifetime parameter on the struct and (b) the where-clauses are implied by the field types within the struct: | |
| ```rust | |
| struct Foo<'x, T> | |
| // where | |
| // T: 'x, <-- added automatically by the compiler | |
| { | |
| r: &'x T | |
| } | |
| ``` | |
| The RFC originally also covered where-clauses relating to `'static`, but the lang-team opted to limit automatic where-clauses to only apply to named lifetime parameters ([rationale]): | |
| [rationale]: https://github.com/rust-lang/rust/issues/54185#issuecomment-1124097663 | |
| ```rust | |
| struct Foo<T> | |
| // where | |
| // T: 'static, <-- NOT added automatically by the compiler | |
| { | |
| r: &'static T // ERROR: `T: 'static` required | |
| } | |
| ``` |
I think this is a good PR but I suggest being clear about the delta.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Applied your suggestion in e16cd4e (#3278)
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
cc rust-lang/rust#54185
r? @pnkfelix
Rendered