TAIT decision on whether nested inner items may define #117860
Labels
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
F-type_alias_impl_trait
`#[feature(type_alias_impl_trait)]`
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
To move forward on TAIT in any form, regardless of how we notate which items may or must define the hidden type of an opaque, we must decide whether the following should be true:
If not allowed, this would be called the "nested inner items restriction,"and we would be closing this door as we could not necessarily lift this restriction later after TAIT is stabilized.
As background, within the body of items, Rust today accepts impls of outer traits for outer types, e.g.:
Analogously, TAIT allows inner items to define the hidden type of an opaque even if the enclosing outer item cannot define the hidden type. E.g.:
And also:
For the purposes of this question, please set aside how we know that the outer item is not allowed to define the hidden type and that the inner item otherwise is; this question is invariant to the details of that.
This issue is nominated for T-lang to decide this question. Since this is mostly separable from other questions of how TAIT is designed, we propose this be decided now so as to reduce the scope of what must be considered and decided in the stabilization PR.
This question was discussed in the 2023-11-08 T-lang Mini-TAIT design meeting (minutes, rust-lang/lang-team#233).
For a full discussion of this question, see:
There was an earlier decision. Back in June, before we knew that if imposed this restriction could not later be lifted, and before we knew of other restrictions likely to be part of the stabilization of TAIT due to considerations for the new trait solver (such as a rule that any item that's allowed to define to hidden type must define the hidden type, again, setting aside how we indicate whether that is allowed), T-lang decided in the #107645 FCP to impose this restriction. Now that we know that it may not later be possible to lift such a restriction, that raises the stakes, and it seems we may want to reanalyze and reconsider this question.
The text was updated successfully, but these errors were encountered: