@@ -2749,6 +2749,8 @@ pub struct BareFnTy<'hir> {
27492749
27502750#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
27512751pub struct OpaqueTy < ' hir > {
2752+ pub hir_id : HirId ,
2753+ pub def_id : LocalDefId ,
27522754 pub generics : & ' hir Generics < ' hir > ,
27532755 pub bounds : GenericBounds < ' hir > ,
27542756 pub origin : OpaqueTyOrigin ,
@@ -2762,6 +2764,7 @@ pub struct OpaqueTy<'hir> {
27622764 /// This mapping associated a captured lifetime (first parameter) with the new
27632765 /// early-bound lifetime that was generated for the opaque.
27642766 pub lifetime_mapping : & ' hir [ ( & ' hir Lifetime , LocalDefId ) ] ,
2767+ pub span : Span ,
27652768}
27662769
27672770#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
@@ -2868,7 +2871,7 @@ pub enum TyKind<'hir> {
28682871 /// possibly parameters) that are actually bound on the `impl Trait`.
28692872 ///
28702873 /// The last parameter specifies whether this opaque appears in a trait definition.
2871- OpaqueDef ( ItemId , & ' hir [ GenericArg < ' hir > ] ) ,
2874+ OpaqueDef ( & ' hir OpaqueTy < ' hir > , & ' hir [ GenericArg < ' hir > ] ) ,
28722875 /// A trait object type `Bound1 + Bound2 + Bound3`
28732876 /// where `Bound` is a trait or a lifetime.
28742877 TraitObject (
@@ -3337,8 +3340,6 @@ impl<'hir> Item<'hir> {
33373340 expect_ty_alias, ( & ' hir Ty <' hir>, & ' hir Generics <' hir>) ,
33383341 ItemKind :: TyAlias ( ty, generics) , ( ty, generics) ;
33393342
3340- expect_opaque_ty, & OpaqueTy <' hir>, ItemKind :: OpaqueTy ( ty) , ty;
3341-
33423343 expect_enum, ( & EnumDef <' hir>, & ' hir Generics <' hir>) , ItemKind :: Enum ( def, generics) , ( def, generics) ;
33433344
33443345 expect_struct, ( & VariantData <' hir>, & ' hir Generics <' hir>) ,
@@ -3451,8 +3452,6 @@ pub enum ItemKind<'hir> {
34513452 GlobalAsm ( & ' hir InlineAsm < ' hir > ) ,
34523453 /// A type alias, e.g., `type Foo = Bar<u8>`.
34533454 TyAlias ( & ' hir Ty < ' hir > , & ' hir Generics < ' hir > ) ,
3454- /// An opaque `impl Trait` type alias, e.g., `type Foo = impl Bar;`.
3455- OpaqueTy ( & ' hir OpaqueTy < ' hir > ) ,
34563455 /// An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`.
34573456 Enum ( EnumDef < ' hir > , & ' hir Generics < ' hir > ) ,
34583457 /// A struct definition, e.g., `struct Foo<A> {x: A}`.
@@ -3496,7 +3495,6 @@ impl ItemKind<'_> {
34963495 ItemKind :: Fn ( _, ref generics, _)
34973496 | ItemKind :: TyAlias ( _, ref generics)
34983497 | ItemKind :: Const ( _, ref generics, _)
3499- | ItemKind :: OpaqueTy ( OpaqueTy { ref generics, .. } )
35003498 | ItemKind :: Enum ( _, ref generics)
35013499 | ItemKind :: Struct ( _, ref generics)
35023500 | ItemKind :: Union ( _, ref generics)
@@ -3519,7 +3517,6 @@ impl ItemKind<'_> {
35193517 ItemKind :: ForeignMod { .. } => "extern block" ,
35203518 ItemKind :: GlobalAsm ( ..) => "global asm item" ,
35213519 ItemKind :: TyAlias ( ..) => "type alias" ,
3522- ItemKind :: OpaqueTy ( ..) => "opaque type" ,
35233520 ItemKind :: Enum ( ..) => "enum" ,
35243521 ItemKind :: Struct ( ..) => "struct" ,
35253522 ItemKind :: Union ( ..) => "union" ,
@@ -3806,6 +3803,7 @@ pub enum Node<'hir> {
38063803 Ty ( & ' hir Ty < ' hir > ) ,
38073804 AssocItemConstraint ( & ' hir AssocItemConstraint < ' hir > ) ,
38083805 TraitRef ( & ' hir TraitRef < ' hir > ) ,
3806+ OpaqueTy ( & ' hir OpaqueTy < ' hir > ) ,
38093807 Pat ( & ' hir Pat < ' hir > ) ,
38103808 PatField ( & ' hir PatField < ' hir > ) ,
38113809 Arm ( & ' hir Arm < ' hir > ) ,
@@ -3871,6 +3869,7 @@ impl<'hir> Node<'hir> {
38713869 | Node :: Crate ( ..)
38723870 | Node :: Ty ( ..)
38733871 | Node :: TraitRef ( ..)
3872+ | Node :: OpaqueTy ( ..)
38743873 | Node :: Infer ( ..)
38753874 | Node :: WhereBoundPredicate ( ..)
38763875 | Node :: ArrayLenInfer ( ..)
@@ -3996,6 +3995,7 @@ impl<'hir> Node<'hir> {
39963995 | Node :: TraitItem ( TraitItem { generics, .. } )
39973996 | Node :: ImplItem ( ImplItem { generics, .. } ) => Some ( generics) ,
39983997 Node :: Item ( item) => item. kind . generics ( ) ,
3998+ Node :: OpaqueTy ( opaque) => Some ( opaque. generics ) ,
39993999 _ => None ,
40004000 }
40014001 }
@@ -4055,6 +4055,7 @@ impl<'hir> Node<'hir> {
40554055 expect_ty, & ' hir Ty <' hir>, Node :: Ty ( n) , n;
40564056 expect_assoc_item_constraint, & ' hir AssocItemConstraint <' hir>, Node :: AssocItemConstraint ( n) , n;
40574057 expect_trait_ref, & ' hir TraitRef <' hir>, Node :: TraitRef ( n) , n;
4058+ expect_opaque_ty, & ' hir OpaqueTy <' hir>, Node :: OpaqueTy ( n) , n;
40584059 expect_pat, & ' hir Pat <' hir>, Node :: Pat ( n) , n;
40594060 expect_pat_field, & ' hir PatField <' hir>, Node :: PatField ( n) , n;
40604061 expect_arm, & ' hir Arm <' hir>, Node :: Arm ( n) , n;
0 commit comments