-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
TAIT: hidden type cannot be another opaque type from the same scope #96406
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Can do after stabilization
I wanted to write a function that statically allocates an
async fnfuture: playgroundThis fails with the following error:
One workaround is to move the
Futto the top level, but that's undesirable because it makes the entire file to be the defining scope, which interferes with other code.A better workaround suggested by @oli-obk is to wrap the inner future in a "dumb" wrapper, so that the types are no longer equal (the RPIT can't be another opaque type itself, but it can still contain one): playground
First, it would be interesting to see if these "nested opaque types" can be allowed in some cases such as this one.
Second, it would be helpful if the diagnostic suggested the "wrapper" workaround. It would've saved me a lot of time at least :)
See also: Zulip thread