@@ -2610,7 +2610,7 @@ impl<'hir> Ty<'hir> {
2610
2610
}
2611
2611
TyKind :: Tup ( tys) => tys. iter ( ) . any ( Self :: is_suggestable_infer_ty) ,
2612
2612
TyKind :: Ptr ( mut_ty) | TyKind :: Ref ( _, mut_ty) => mut_ty. ty . is_suggestable_infer_ty ( ) ,
2613
- TyKind :: OpaqueDef ( _, generic_args, _ ) => are_suggestable_generic_args ( generic_args) ,
2613
+ TyKind :: OpaqueDef ( _, generic_args) => are_suggestable_generic_args ( generic_args) ,
2614
2614
TyKind :: Path ( QPath :: TypeRelative ( ty, segment) ) => {
2615
2615
ty. is_suggestable_infer_ty ( ) || are_suggestable_generic_args ( segment. args ( ) . args )
2616
2616
}
@@ -2727,6 +2727,8 @@ pub struct BareFnTy<'hir> {
2727
2727
2728
2728
#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
2729
2729
pub struct OpaqueTy < ' hir > {
2730
+ pub hir_id : HirId ,
2731
+ pub def_id : LocalDefId ,
2730
2732
pub generics : & ' hir Generics < ' hir > ,
2731
2733
pub bounds : GenericBounds < ' hir > ,
2732
2734
pub origin : OpaqueTyOrigin ,
@@ -2744,6 +2746,7 @@ pub struct OpaqueTy<'hir> {
2744
2746
/// originating from a trait method. This makes it so that the opaque is
2745
2747
/// lowered as an associated type.
2746
2748
pub in_trait : bool ,
2749
+ pub span : Span ,
2747
2750
}
2748
2751
2749
2752
#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
@@ -2834,7 +2837,7 @@ pub enum TyKind<'hir> {
2834
2837
/// possibly parameters) that are actually bound on the `impl Trait`.
2835
2838
///
2836
2839
/// The last parameter specifies whether this opaque appears in a trait definition.
2837
- OpaqueDef ( ItemId , & ' hir [ GenericArg < ' hir > ] , bool ) ,
2840
+ OpaqueDef ( & ' hir OpaqueTy < ' hir > , & ' hir [ GenericArg < ' hir > ] ) ,
2838
2841
/// A trait object type `Bound1 + Bound2 + Bound3`
2839
2842
/// where `Bound` is a trait or a lifetime.
2840
2843
TraitObject (
@@ -3301,8 +3304,6 @@ impl<'hir> Item<'hir> {
3301
3304
expect_ty_alias, ( & ' hir Ty <' hir>, & ' hir Generics <' hir>) ,
3302
3305
ItemKind :: TyAlias ( ty, generics) , ( ty, generics) ;
3303
3306
3304
- expect_opaque_ty, & OpaqueTy <' hir>, ItemKind :: OpaqueTy ( ty) , ty;
3305
-
3306
3307
expect_enum, ( & EnumDef <' hir>, & ' hir Generics <' hir>) , ItemKind :: Enum ( def, generics) , ( def, generics) ;
3307
3308
3308
3309
expect_struct, ( & VariantData <' hir>, & ' hir Generics <' hir>) ,
@@ -3415,8 +3416,6 @@ pub enum ItemKind<'hir> {
3415
3416
GlobalAsm ( & ' hir InlineAsm < ' hir > ) ,
3416
3417
/// A type alias, e.g., `type Foo = Bar<u8>`.
3417
3418
TyAlias ( & ' hir Ty < ' hir > , & ' hir Generics < ' hir > ) ,
3418
- /// An opaque `impl Trait` type alias, e.g., `type Foo = impl Bar;`.
3419
- OpaqueTy ( & ' hir OpaqueTy < ' hir > ) ,
3420
3419
/// An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`.
3421
3420
Enum ( EnumDef < ' hir > , & ' hir Generics < ' hir > ) ,
3422
3421
/// A struct definition, e.g., `struct Foo<A> {x: A}`.
@@ -3460,7 +3459,6 @@ impl ItemKind<'_> {
3460
3459
ItemKind :: Fn ( _, ref generics, _)
3461
3460
| ItemKind :: TyAlias ( _, ref generics)
3462
3461
| ItemKind :: Const ( _, ref generics, _)
3463
- | ItemKind :: OpaqueTy ( OpaqueTy { ref generics, .. } )
3464
3462
| ItemKind :: Enum ( _, ref generics)
3465
3463
| ItemKind :: Struct ( _, ref generics)
3466
3464
| ItemKind :: Union ( _, ref generics)
@@ -3483,7 +3481,6 @@ impl ItemKind<'_> {
3483
3481
ItemKind :: ForeignMod { .. } => "extern block" ,
3484
3482
ItemKind :: GlobalAsm ( ..) => "global asm item" ,
3485
3483
ItemKind :: TyAlias ( ..) => "type alias" ,
3486
- ItemKind :: OpaqueTy ( ..) => "opaque type" ,
3487
3484
ItemKind :: Enum ( ..) => "enum" ,
3488
3485
ItemKind :: Struct ( ..) => "struct" ,
3489
3486
ItemKind :: Union ( ..) => "union" ,
@@ -3770,6 +3767,7 @@ pub enum Node<'hir> {
3770
3767
Ty ( & ' hir Ty < ' hir > ) ,
3771
3768
AssocItemConstraint ( & ' hir AssocItemConstraint < ' hir > ) ,
3772
3769
TraitRef ( & ' hir TraitRef < ' hir > ) ,
3770
+ OpaqueTy ( & ' hir OpaqueTy < ' hir > ) ,
3773
3771
Pat ( & ' hir Pat < ' hir > ) ,
3774
3772
PatField ( & ' hir PatField < ' hir > ) ,
3775
3773
Arm ( & ' hir Arm < ' hir > ) ,
@@ -3835,6 +3833,7 @@ impl<'hir> Node<'hir> {
3835
3833
| Node :: Crate ( ..)
3836
3834
| Node :: Ty ( ..)
3837
3835
| Node :: TraitRef ( ..)
3836
+ | Node :: OpaqueTy ( ..)
3838
3837
| Node :: Infer ( ..)
3839
3838
| Node :: WhereBoundPredicate ( ..)
3840
3839
| Node :: ArrayLenInfer ( ..)
@@ -3960,6 +3959,7 @@ impl<'hir> Node<'hir> {
3960
3959
| Node :: TraitItem ( TraitItem { generics, .. } )
3961
3960
| Node :: ImplItem ( ImplItem { generics, .. } ) => Some ( generics) ,
3962
3961
Node :: Item ( item) => item. kind . generics ( ) ,
3962
+ Node :: OpaqueTy ( opaque) => Some ( opaque. generics ) ,
3963
3963
_ => None ,
3964
3964
}
3965
3965
}
@@ -4019,6 +4019,7 @@ impl<'hir> Node<'hir> {
4019
4019
expect_ty, & ' hir Ty <' hir>, Node :: Ty ( n) , n;
4020
4020
expect_assoc_item_constraint, & ' hir AssocItemConstraint <' hir>, Node :: AssocItemConstraint ( n) , n;
4021
4021
expect_trait_ref, & ' hir TraitRef <' hir>, Node :: TraitRef ( n) , n;
4022
+ expect_opaque_ty, & ' hir OpaqueTy <' hir>, Node :: OpaqueTy ( n) , n;
4022
4023
expect_pat, & ' hir Pat <' hir>, Node :: Pat ( n) , n;
4023
4024
expect_pat_field, & ' hir PatField <' hir>, Node :: PatField ( n) , n;
4024
4025
expect_arm, & ' hir Arm <' hir>, Node :: Arm ( n) , n;
0 commit comments