Open
Description
The following snippet fails
#![feature(type_alias_impl_trait)]
trait Trait<'a> { type Out: 'a;}
impl<'a> Trait<'a> for i32 { type Out = String;}
type A = impl for<'a> Trait<'a, Out = impl Sized + 'a>;
fn foo() -> A {
0_i32
}
The error is
error: non-defining opaque type use in defining scope
--> src/lib.rs:6:5
|
6 | 0_i32
| ^^^^^
|
note: used non-generic lifetime `'a` for generic parameter
--> src/lib.rs:4:52
|
4 | type A = impl for<'a> Trait<'a, Out = impl Sized + 'a>;
| ^^
Originally posted by @oli-obk in #96094 (comment)
Metadata
Metadata
Assignees
Labels
Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Category: This is a bug.`#[feature(type_alias_impl_trait)]`Relevant to the types team, which will review and decide on the PR/issue.
Type
Projects
Status
Can do after stabilization