-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking Issue for Reborrow trait lang experiment #145612
Copy link
Copy link
Open
Labels
B-experimentalBlocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).Blocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).C-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 RFCF-reborrow`#![feature(reborrow)]`; see #145612`#![feature(reborrow)]`; see #145612I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
B-experimentalBlocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).Blocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).C-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 RFCF-reborrow`#![feature(reborrow)]`; see #145612`#![feature(reborrow)]`; see #145612I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Exploration
This is a tracking issue for the lang experiment into a Reborrow trait and its dual CoerceShared trait.
The feature gate for the issue is
#![feature(reborrow)].For more information, see the 2025H2 project goal and the draft RFC.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Steps
Unresolved Questions
The implementation of the Reborrow trait is likely something like this:
This allows the compiler to see the individual field usages and, eventually, enables the correct lifetimes to be "used as exclusive". But the question is; where does this bottom out? Is any field that implements
Reborrow(but notCopy, ifReborrowis blanket-implemented forCopytypes) a point where the recursion into structs stops? That stops composing of reborrowable types to a depth of 2. Is aPhantomReborrowable<'a>marker type needed? If so, then what is the variance of the lifetime there?Implementation history