@@ -2749,6 +2749,8 @@ pub struct BareFnTy<'hir> {
2749
2749
2750
2750
#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
2751
2751
pub struct OpaqueTy < ' hir > {
2752
+ pub hir_id : HirId ,
2753
+ pub def_id : LocalDefId ,
2752
2754
pub generics : & ' hir Generics < ' hir > ,
2753
2755
pub bounds : GenericBounds < ' hir > ,
2754
2756
pub origin : OpaqueTyOrigin ,
@@ -2762,6 +2764,7 @@ pub struct OpaqueTy<'hir> {
2762
2764
/// This mapping associated a captured lifetime (first parameter) with the new
2763
2765
/// early-bound lifetime that was generated for the opaque.
2764
2766
pub lifetime_mapping : & ' hir [ ( & ' hir Lifetime , LocalDefId ) ] ,
2767
+ pub span : Span ,
2765
2768
}
2766
2769
2767
2770
#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
@@ -2868,7 +2871,7 @@ pub enum TyKind<'hir> {
2868
2871
/// possibly parameters) that are actually bound on the `impl Trait`.
2869
2872
///
2870
2873
/// 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 > ] ) ,
2872
2875
/// A trait object type `Bound1 + Bound2 + Bound3`
2873
2876
/// where `Bound` is a trait or a lifetime.
2874
2877
TraitObject (
@@ -3337,8 +3340,6 @@ impl<'hir> Item<'hir> {
3337
3340
expect_ty_alias, ( & ' hir Ty <' hir>, & ' hir Generics <' hir>) ,
3338
3341
ItemKind :: TyAlias ( ty, generics) , ( ty, generics) ;
3339
3342
3340
- expect_opaque_ty, & OpaqueTy <' hir>, ItemKind :: OpaqueTy ( ty) , ty;
3341
-
3342
3343
expect_enum, ( & EnumDef <' hir>, & ' hir Generics <' hir>) , ItemKind :: Enum ( def, generics) , ( def, generics) ;
3343
3344
3344
3345
expect_struct, ( & VariantData <' hir>, & ' hir Generics <' hir>) ,
@@ -3451,8 +3452,6 @@ pub enum ItemKind<'hir> {
3451
3452
GlobalAsm ( & ' hir InlineAsm < ' hir > ) ,
3452
3453
/// A type alias, e.g., `type Foo = Bar<u8>`.
3453
3454
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 > ) ,
3456
3455
/// An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`.
3457
3456
Enum ( EnumDef < ' hir > , & ' hir Generics < ' hir > ) ,
3458
3457
/// A struct definition, e.g., `struct Foo<A> {x: A}`.
@@ -3496,7 +3495,6 @@ impl ItemKind<'_> {
3496
3495
ItemKind :: Fn ( _, ref generics, _)
3497
3496
| ItemKind :: TyAlias ( _, ref generics)
3498
3497
| ItemKind :: Const ( _, ref generics, _)
3499
- | ItemKind :: OpaqueTy ( OpaqueTy { ref generics, .. } )
3500
3498
| ItemKind :: Enum ( _, ref generics)
3501
3499
| ItemKind :: Struct ( _, ref generics)
3502
3500
| ItemKind :: Union ( _, ref generics)
@@ -3519,7 +3517,6 @@ impl ItemKind<'_> {
3519
3517
ItemKind :: ForeignMod { .. } => "extern block" ,
3520
3518
ItemKind :: GlobalAsm ( ..) => "global asm item" ,
3521
3519
ItemKind :: TyAlias ( ..) => "type alias" ,
3522
- ItemKind :: OpaqueTy ( ..) => "opaque type" ,
3523
3520
ItemKind :: Enum ( ..) => "enum" ,
3524
3521
ItemKind :: Struct ( ..) => "struct" ,
3525
3522
ItemKind :: Union ( ..) => "union" ,
@@ -3806,6 +3803,7 @@ pub enum Node<'hir> {
3806
3803
Ty ( & ' hir Ty < ' hir > ) ,
3807
3804
AssocItemConstraint ( & ' hir AssocItemConstraint < ' hir > ) ,
3808
3805
TraitRef ( & ' hir TraitRef < ' hir > ) ,
3806
+ OpaqueTy ( & ' hir OpaqueTy < ' hir > ) ,
3809
3807
Pat ( & ' hir Pat < ' hir > ) ,
3810
3808
PatField ( & ' hir PatField < ' hir > ) ,
3811
3809
Arm ( & ' hir Arm < ' hir > ) ,
@@ -3871,6 +3869,7 @@ impl<'hir> Node<'hir> {
3871
3869
| Node :: Crate ( ..)
3872
3870
| Node :: Ty ( ..)
3873
3871
| Node :: TraitRef ( ..)
3872
+ | Node :: OpaqueTy ( ..)
3874
3873
| Node :: Infer ( ..)
3875
3874
| Node :: WhereBoundPredicate ( ..)
3876
3875
| Node :: ArrayLenInfer ( ..)
@@ -3996,6 +3995,7 @@ impl<'hir> Node<'hir> {
3996
3995
| Node :: TraitItem ( TraitItem { generics, .. } )
3997
3996
| Node :: ImplItem ( ImplItem { generics, .. } ) => Some ( generics) ,
3998
3997
Node :: Item ( item) => item. kind . generics ( ) ,
3998
+ Node :: OpaqueTy ( opaque) => Some ( opaque. generics ) ,
3999
3999
_ => None ,
4000
4000
}
4001
4001
}
@@ -4055,6 +4055,7 @@ impl<'hir> Node<'hir> {
4055
4055
expect_ty, & ' hir Ty <' hir>, Node :: Ty ( n) , n;
4056
4056
expect_assoc_item_constraint, & ' hir AssocItemConstraint <' hir>, Node :: AssocItemConstraint ( n) , n;
4057
4057
expect_trait_ref, & ' hir TraitRef <' hir>, Node :: TraitRef ( n) , n;
4058
+ expect_opaque_ty, & ' hir OpaqueTy <' hir>, Node :: OpaqueTy ( n) , n;
4058
4059
expect_pat, & ' hir Pat <' hir>, Node :: Pat ( n) , n;
4059
4060
expect_pat_field, & ' hir PatField <' hir>, Node :: PatField ( n) , n;
4060
4061
expect_arm, & ' hir Arm <' hir>, Node :: Arm ( n) , n;
0 commit comments