@@ -2610,7 +2610,7 @@ impl<'hir> Ty<'hir> {
26102610 }
26112611 TyKind :: Tup ( tys) => tys. iter ( ) . any ( Self :: is_suggestable_infer_ty) ,
26122612 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) ,
26142614 TyKind :: Path ( QPath :: TypeRelative ( ty, segment) ) => {
26152615 ty. is_suggestable_infer_ty ( ) || are_suggestable_generic_args ( segment. args ( ) . args )
26162616 }
@@ -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 ) ]
@@ -2834,7 +2837,7 @@ pub enum TyKind<'hir> {
28342837 /// possibly parameters) that are actually bound on the `impl Trait`.
28352838 ///
28362839 /// 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 > ] ) ,
28382841 /// A trait object type `Bound1 + Bound2 + Bound3`
28392842 /// where `Bound` is a trait or a lifetime.
28402843 TraitObject (
@@ -3301,8 +3304,6 @@ impl<'hir> Item<'hir> {
33013304 expect_ty_alias, ( & ' hir Ty <' hir>, & ' hir Generics <' hir>) ,
33023305 ItemKind :: TyAlias ( ty, generics) , ( ty, generics) ;
33033306
3304- expect_opaque_ty, & OpaqueTy <' hir>, ItemKind :: OpaqueTy ( ty) , ty;
3305-
33063307 expect_enum, ( & EnumDef <' hir>, & ' hir Generics <' hir>) , ItemKind :: Enum ( def, generics) , ( def, generics) ;
33073308
33083309 expect_struct, ( & VariantData <' hir>, & ' hir Generics <' hir>) ,
@@ -3415,8 +3416,6 @@ pub enum ItemKind<'hir> {
34153416 GlobalAsm ( & ' hir InlineAsm < ' hir > ) ,
34163417 /// A type alias, e.g., `type Foo = Bar<u8>`.
34173418 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 > ) ,
34203419 /// An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`.
34213420 Enum ( EnumDef < ' hir > , & ' hir Generics < ' hir > ) ,
34223421 /// A struct definition, e.g., `struct Foo<A> {x: A}`.
@@ -3460,7 +3459,6 @@ impl ItemKind<'_> {
34603459 ItemKind :: Fn ( _, ref generics, _)
34613460 | ItemKind :: TyAlias ( _, ref generics)
34623461 | ItemKind :: Const ( _, ref generics, _)
3463- | ItemKind :: OpaqueTy ( OpaqueTy { ref generics, .. } )
34643462 | ItemKind :: Enum ( _, ref generics)
34653463 | ItemKind :: Struct ( _, ref generics)
34663464 | ItemKind :: Union ( _, ref generics)
@@ -3483,7 +3481,6 @@ impl ItemKind<'_> {
34833481 ItemKind :: ForeignMod { .. } => "extern block" ,
34843482 ItemKind :: GlobalAsm ( ..) => "global asm item" ,
34853483 ItemKind :: TyAlias ( ..) => "type alias" ,
3486- ItemKind :: OpaqueTy ( ..) => "opaque type" ,
34873484 ItemKind :: Enum ( ..) => "enum" ,
34883485 ItemKind :: Struct ( ..) => "struct" ,
34893486 ItemKind :: Union ( ..) => "union" ,
@@ -3770,6 +3767,7 @@ pub enum Node<'hir> {
37703767 Ty ( & ' hir Ty < ' hir > ) ,
37713768 AssocItemConstraint ( & ' hir AssocItemConstraint < ' hir > ) ,
37723769 TraitRef ( & ' hir TraitRef < ' hir > ) ,
3770+ OpaqueTy ( & ' hir OpaqueTy < ' hir > ) ,
37733771 Pat ( & ' hir Pat < ' hir > ) ,
37743772 PatField ( & ' hir PatField < ' hir > ) ,
37753773 Arm ( & ' hir Arm < ' hir > ) ,
@@ -3835,6 +3833,7 @@ impl<'hir> Node<'hir> {
38353833 | Node :: Crate ( ..)
38363834 | Node :: Ty ( ..)
38373835 | Node :: TraitRef ( ..)
3836+ | Node :: OpaqueTy ( ..)
38383837 | Node :: Infer ( ..)
38393838 | Node :: WhereBoundPredicate ( ..)
38403839 | Node :: ArrayLenInfer ( ..)
@@ -3960,6 +3959,7 @@ impl<'hir> Node<'hir> {
39603959 | Node :: TraitItem ( TraitItem { generics, .. } )
39613960 | Node :: ImplItem ( ImplItem { generics, .. } ) => Some ( generics) ,
39623961 Node :: Item ( item) => item. kind . generics ( ) ,
3962+ Node :: OpaqueTy ( opaque) => Some ( opaque. generics ) ,
39633963 _ => None ,
39643964 }
39653965 }
@@ -4019,6 +4019,7 @@ impl<'hir> Node<'hir> {
40194019 expect_ty, & ' hir Ty <' hir>, Node :: Ty ( n) , n;
40204020 expect_assoc_item_constraint, & ' hir AssocItemConstraint <' hir>, Node :: AssocItemConstraint ( n) , n;
40214021 expect_trait_ref, & ' hir TraitRef <' hir>, Node :: TraitRef ( n) , n;
4022+ expect_opaque_ty, & ' hir OpaqueTy <' hir>, Node :: OpaqueTy ( n) , n;
40224023 expect_pat, & ' hir Pat <' hir>, Node :: Pat ( n) , n;
40234024 expect_pat_field, & ' hir PatField <' hir>, Node :: PatField ( n) , n;
40244025 expect_arm, & ' hir Arm <' hir>, Node :: Arm ( n) , n;
0 commit comments