@@ -2727,6 +2727,8 @@ pub struct BareFnTy<'hir> {
27272727
27282728#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
27292729pub struct OpaqueTy < ' hir > {
2730+ pub hir_id : HirId ,
2731+ pub def_id : LocalDefId ,
27302732 pub generics : & ' hir Generics < ' hir > ,
27312733 pub bounds : GenericBounds < ' hir > ,
27322734 pub origin : OpaqueTyOrigin ,
@@ -2744,6 +2746,7 @@ pub struct OpaqueTy<'hir> {
27442746 /// originating from a trait method. This makes it so that the opaque is
27452747 /// lowered as an associated type.
27462748 pub in_trait : bool ,
2749+ pub span : Span ,
27472750}
27482751
27492752#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
@@ -2835,7 +2838,7 @@ pub enum TyKind<'hir> {
28352838 /// possibly parameters) that are actually bound on the `impl Trait`.
28362839 ///
28372840 /// The last parameter specifies whether this opaque appears in a trait definition.
2838- OpaqueDef ( ItemId , & ' hir [ GenericArg < ' hir > ] , bool ) ,
2841+ OpaqueDef ( & ' hir OpaqueTy < ' hir > , & ' hir [ GenericArg < ' hir > ] , bool ) ,
28392842 /// A trait object type `Bound1 + Bound2 + Bound3`
28402843 /// where `Bound` is a trait or a lifetime.
28412844 TraitObject (
@@ -3302,8 +3305,6 @@ impl<'hir> Item<'hir> {
33023305 expect_ty_alias, ( & ' hir Ty <' hir>, & ' hir Generics <' hir>) ,
33033306 ItemKind :: TyAlias ( ty, generics) , ( ty, generics) ;
33043307
3305- expect_opaque_ty, & OpaqueTy <' hir>, ItemKind :: OpaqueTy ( ty) , ty;
3306-
33073308 expect_enum, ( & EnumDef <' hir>, & ' hir Generics <' hir>) , ItemKind :: Enum ( def, generics) , ( def, generics) ;
33083309
33093310 expect_struct, ( & VariantData <' hir>, & ' hir Generics <' hir>) ,
@@ -3416,8 +3417,6 @@ pub enum ItemKind<'hir> {
34163417 GlobalAsm ( & ' hir InlineAsm < ' hir > ) ,
34173418 /// A type alias, e.g., `type Foo = Bar<u8>`.
34183419 TyAlias ( & ' hir Ty < ' hir > , & ' hir Generics < ' hir > ) ,
3419- /// An opaque `impl Trait` type alias, e.g., `type Foo = impl Bar;`.
3420- OpaqueTy ( & ' hir OpaqueTy < ' hir > ) ,
34213420 /// An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`.
34223421 Enum ( EnumDef < ' hir > , & ' hir Generics < ' hir > ) ,
34233422 /// A struct definition, e.g., `struct Foo<A> {x: A}`.
@@ -3461,7 +3460,6 @@ impl ItemKind<'_> {
34613460 ItemKind :: Fn ( _, ref generics, _)
34623461 | ItemKind :: TyAlias ( _, ref generics)
34633462 | ItemKind :: Const ( _, ref generics, _)
3464- | ItemKind :: OpaqueTy ( OpaqueTy { ref generics, .. } )
34653463 | ItemKind :: Enum ( _, ref generics)
34663464 | ItemKind :: Struct ( _, ref generics)
34673465 | ItemKind :: Union ( _, ref generics)
@@ -3484,7 +3482,6 @@ impl ItemKind<'_> {
34843482 ItemKind :: ForeignMod { .. } => "extern block" ,
34853483 ItemKind :: GlobalAsm ( ..) => "global asm item" ,
34863484 ItemKind :: TyAlias ( ..) => "type alias" ,
3487- ItemKind :: OpaqueTy ( ..) => "opaque type" ,
34883485 ItemKind :: Enum ( ..) => "enum" ,
34893486 ItemKind :: Struct ( ..) => "struct" ,
34903487 ItemKind :: Union ( ..) => "union" ,
@@ -3771,6 +3768,7 @@ pub enum Node<'hir> {
37713768 Ty ( & ' hir Ty < ' hir > ) ,
37723769 AssocItemConstraint ( & ' hir AssocItemConstraint < ' hir > ) ,
37733770 TraitRef ( & ' hir TraitRef < ' hir > ) ,
3771+ OpaqueTy ( & ' hir OpaqueTy < ' hir > ) ,
37743772 Pat ( & ' hir Pat < ' hir > ) ,
37753773 PatField ( & ' hir PatField < ' hir > ) ,
37763774 Arm ( & ' hir Arm < ' hir > ) ,
@@ -3836,6 +3834,7 @@ impl<'hir> Node<'hir> {
38363834 | Node :: Crate ( ..)
38373835 | Node :: Ty ( ..)
38383836 | Node :: TraitRef ( ..)
3837+ | Node :: OpaqueTy ( ..)
38393838 | Node :: Infer ( ..)
38403839 | Node :: WhereBoundPredicate ( ..)
38413840 | Node :: ArrayLenInfer ( ..)
@@ -3961,6 +3960,7 @@ impl<'hir> Node<'hir> {
39613960 | Node :: TraitItem ( TraitItem { generics, .. } )
39623961 | Node :: ImplItem ( ImplItem { generics, .. } ) => Some ( generics) ,
39633962 Node :: Item ( item) => item. kind . generics ( ) ,
3963+ Node :: OpaqueTy ( opaq) => Some ( opaq. generics ) ,
39643964 _ => None ,
39653965 }
39663966 }
@@ -4020,6 +4020,7 @@ impl<'hir> Node<'hir> {
40204020 expect_ty, & ' hir Ty <' hir>, Node :: Ty ( n) , n;
40214021 expect_assoc_item_constraint, & ' hir AssocItemConstraint <' hir>, Node :: AssocItemConstraint ( n) , n;
40224022 expect_trait_ref, & ' hir TraitRef <' hir>, Node :: TraitRef ( n) , n;
4023+ expect_opaque_ty, & ' hir OpaqueTy <' hir>, Node :: OpaqueTy ( n) , n;
40234024 expect_pat, & ' hir Pat <' hir>, Node :: Pat ( n) , n;
40244025 expect_pat_field, & ' hir PatField <' hir>, Node :: PatField ( n) , n;
40254026 expect_arm, & ' hir Arm <' hir>, Node :: Arm ( n) , n;
0 commit comments