Tracking issue for RFC 2093: Infer T: 'x
outlives requirements on structs #44493
Closed
Description
This is a tracking issue for the RFC "Infer T: 'x
outlives requirements on structs " (rust-lang/rfcs#2093).
Current status:
Implemented and we have decided to stabilize. We still need someone to make the stabilization PR! Mentoring instructions here:
https://github.com/rust-lang/rust/issue_comments#issuecomment-411781121
Until then, you can use this by adding #![feature(infer_outlives_requirements)]
to your crate.
Steps:
- Implement the RFC (mentoring instructions here)
- Adjust documentation (see instructions on forge)
- Stabilization PR (see instructions on forge)
Unresolved questions:
The interaction with 'static
remains a bit unclear. For example, do we want to infer a T: 'static
requirement on the type parameter T
here? The code currently will do so, arguably leading to confusing errors.
#![feature(infer_outlives_requirements)]
struct Foo<T> { t: &'static T }
fn main() {
let x = 3;
let _ = Foo { t: &x };
}
Metadata
Assignees
Labels
Blocker: Approved by a merged RFC but not yet implemented.Category: An issue tracking the progress of sth. like the implementation of an RFCCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.High priorityRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the language team, which will review and decide on the PR/issue.This issue / PR is in PFCP or FCP with a disposition to merge it.The final comment period is finished for this PR / Issue.