@@ -2518,6 +2518,12 @@ pub enum OpaqueTyOrigin {
25182518 TyAlias ,
25192519}
25202520
2521+ /// Placeholder representation of an `impl Trait` in a trait. Since this never gets lowered into a `ty::Opaque` of its own, we just keep this as
2522+ #[ derive( Debug , HashStable_Generic ) ]
2523+ pub struct ImplTraitPlaceholder < ' hir > {
2524+ pub bounds : GenericBounds < ' hir > ,
2525+ }
2526+
25212527/// The various kinds of types recognized by the compiler.
25222528#[ derive( Debug , HashStable_Generic ) ]
25232529pub enum TyKind < ' hir > {
@@ -2545,6 +2551,8 @@ pub enum TyKind<'hir> {
25452551 /// The generic argument list contains the lifetimes (and in the future
25462552 /// possibly parameters) that are actually bound on the `impl Trait`.
25472553 OpaqueDef ( ItemId , & ' hir [ GenericArg < ' hir > ] ) ,
2554+ /// The placeholder
2555+ ImplTraitInTrait ( ItemId ) ,
25482556 /// A trait object type `Bound1 + Bound2 + Bound3`
25492557 /// where `Bound` is a trait or a lifetime.
25502558 TraitObject ( & ' hir [ PolyTraitRef < ' hir > ] , & ' hir Lifetime , TraitObjectSyntax ) ,
@@ -3000,6 +3008,8 @@ pub enum ItemKind<'hir> {
30003008 TyAlias ( & ' hir Ty < ' hir > , & ' hir Generics < ' hir > ) ,
30013009 /// An opaque `impl Trait` type alias, e.g., `type Foo = impl Bar;`.
30023010 OpaqueTy ( OpaqueTy < ' hir > ) ,
3011+ /// An `impl Trait` in a trait
3012+ ImplTraitPlaceholder ( ImplTraitPlaceholder < ' hir > ) ,
30033013 /// An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`.
30043014 Enum ( EnumDef < ' hir > , & ' hir Generics < ' hir > ) ,
30053015 /// A struct definition, e.g., `struct Foo<A> {x: A}`.
@@ -3068,6 +3078,7 @@ impl ItemKind<'_> {
30683078 ItemKind :: Trait ( ..) => "trait" ,
30693079 ItemKind :: TraitAlias ( ..) => "trait alias" ,
30703080 ItemKind :: Impl ( ..) => "implementation" ,
3081+ ItemKind :: ImplTraitPlaceholder ( ..) => "opaque type in trait" ,
30713082 }
30723083 }
30733084}
0 commit comments