@@ -1721,38 +1721,38 @@ impl<'a> LoweringContext<'a> {
17211721 & mut self ,
17221722 span : Span ,
17231723 fn_def_id : Option < DefId > ,
1724- exist_ty_node_id : NodeId ,
1724+ opaque_ty_node_id : NodeId ,
17251725 lower_bounds : impl FnOnce ( & mut LoweringContext < ' _ > ) -> hir:: GenericBounds ,
17261726 ) -> hir:: TyKind {
17271727 // Make sure we know that some funky desugaring has been going on here.
17281728 // This is a first: there is code in other places like for loop
17291729 // desugaring that explicitly states that we don't want to track that.
17301730 // Not tracking it makes lints in rustc and clippy very fragile, as
17311731 // frequently opened issues show.
1732- let exist_ty_span = self . mark_span_with_reason (
1732+ let opaque_ty_span = self . mark_span_with_reason (
17331733 DesugaringKind :: OpaqueTy ,
17341734 span,
17351735 None ,
17361736 ) ;
17371737
1738- let exist_ty_def_index = self
1738+ let opaque_ty_def_index = self
17391739 . resolver
17401740 . definitions ( )
1741- . opt_def_index ( exist_ty_node_id )
1741+ . opt_def_index ( opaque_ty_node_id )
17421742 . unwrap ( ) ;
17431743
1744- self . allocate_hir_id_counter ( exist_ty_node_id ) ;
1744+ self . allocate_hir_id_counter ( opaque_ty_node_id ) ;
17451745
1746- let hir_bounds = self . with_hir_id_owner ( exist_ty_node_id , lower_bounds) ;
1746+ let hir_bounds = self . with_hir_id_owner ( opaque_ty_node_id , lower_bounds) ;
17471747
17481748 let ( lifetimes, lifetime_defs) = self . lifetimes_from_impl_trait_bounds (
1749- exist_ty_node_id ,
1750- exist_ty_def_index ,
1749+ opaque_ty_node_id ,
1750+ opaque_ty_def_index ,
17511751 & hir_bounds,
17521752 ) ;
17531753
1754- self . with_hir_id_owner ( exist_ty_node_id , |lctx| {
1755- let exist_ty_item = hir:: ExistTy {
1754+ self . with_hir_id_owner ( opaque_ty_node_id , |lctx| {
1755+ let opaque_ty_item = hir:: OpaqueTy {
17561756 generics : hir:: Generics {
17571757 params : lifetime_defs,
17581758 where_clause : hir:: WhereClause {
@@ -1766,51 +1766,51 @@ impl<'a> LoweringContext<'a> {
17661766 origin : hir:: OpaqueTyOrigin :: ReturnImplTrait ,
17671767 } ;
17681768
1769- trace ! ( "exist ty from impl trait def-index: {:#?}" , exist_ty_def_index ) ;
1770- let exist_ty_id = lctx. generate_opaque_type (
1771- exist_ty_node_id ,
1772- exist_ty_item ,
1769+ trace ! ( "exist ty from impl trait def-index: {:#?}" , opaque_ty_def_index ) ;
1770+ let opaque_ty_id = lctx. generate_opaque_type (
1771+ opaque_ty_node_id ,
1772+ opaque_ty_item ,
17731773 span,
1774- exist_ty_span ,
1774+ opaque_ty_span ,
17751775 ) ;
17761776
17771777 // `impl Trait` now just becomes `Foo<'a, 'b, ..>`.
1778- hir:: TyKind :: Def ( hir:: ItemId { id : exist_ty_id } , lifetimes)
1778+ hir:: TyKind :: Def ( hir:: ItemId { id : opaque_ty_id } , lifetimes)
17791779 } )
17801780 }
17811781
17821782 /// Registers a new opaque type with the proper `NodeId`s and
17831783 /// returns the lowered node-ID for the opaque type.
17841784 fn generate_opaque_type (
17851785 & mut self ,
1786- exist_ty_node_id : NodeId ,
1787- exist_ty_item : hir:: ExistTy ,
1786+ opaque_ty_node_id : NodeId ,
1787+ opaque_ty_item : hir:: OpaqueTy ,
17881788 span : Span ,
1789- exist_ty_span : Span ,
1789+ opaque_ty_span : Span ,
17901790 ) -> hir:: HirId {
1791- let exist_ty_item_kind = hir:: ItemKind :: OpaqueTy ( exist_ty_item ) ;
1792- let exist_ty_id = self . lower_node_id ( exist_ty_node_id ) ;
1791+ let opaque_ty_item_kind = hir:: ItemKind :: OpaqueTy ( opaque_ty_item ) ;
1792+ let opaque_ty_id = self . lower_node_id ( opaque_ty_node_id ) ;
17931793 // Generate an `type Foo = impl Trait;` declaration.
1794- trace ! ( "registering opaque type with id {:#?}" , exist_ty_id ) ;
1795- let exist_ty_item = hir:: Item {
1796- hir_id : exist_ty_id ,
1794+ trace ! ( "registering opaque type with id {:#?}" , opaque_ty_id ) ;
1795+ let opaque_ty_item = hir:: Item {
1796+ hir_id : opaque_ty_id ,
17971797 ident : Ident :: invalid ( ) ,
17981798 attrs : Default :: default ( ) ,
1799- node : exist_ty_item_kind ,
1799+ node : opaque_ty_item_kind ,
18001800 vis : respan ( span. shrink_to_lo ( ) , hir:: VisibilityKind :: Inherited ) ,
1801- span : exist_ty_span ,
1801+ span : opaque_ty_span ,
18021802 } ;
18031803
18041804 // Insert the item into the global item list. This usually happens
18051805 // automatically for all AST items. But this opaque type item
18061806 // does not actually exist in the AST.
1807- self . insert_item ( exist_ty_item ) ;
1808- exist_ty_id
1807+ self . insert_item ( opaque_ty_item ) ;
1808+ opaque_ty_id
18091809 }
18101810
18111811 fn lifetimes_from_impl_trait_bounds (
18121812 & mut self ,
1813- exist_ty_id : NodeId ,
1813+ opaque_ty_id : NodeId ,
18141814 parent_index : DefIndex ,
18151815 bounds : & hir:: GenericBounds ,
18161816 ) -> ( HirVec < hir:: GenericArg > , HirVec < hir:: GenericParam > ) {
@@ -1820,7 +1820,7 @@ impl<'a> LoweringContext<'a> {
18201820 struct ImplTraitLifetimeCollector < ' r , ' a > {
18211821 context : & ' r mut LoweringContext < ' a > ,
18221822 parent : DefIndex ,
1823- exist_ty_id : NodeId ,
1823+ opaque_ty_id : NodeId ,
18241824 collect_elided_lifetimes : bool ,
18251825 currently_bound_lifetimes : Vec < hir:: LifetimeName > ,
18261826 already_defined_lifetimes : FxHashSet < hir:: LifetimeName > ,
@@ -1916,7 +1916,7 @@ impl<'a> LoweringContext<'a> {
19161916
19171917 let def_node_id = self . context . sess . next_node_id ( ) ;
19181918 let hir_id =
1919- self . context . lower_node_id_with_owner ( def_node_id, self . exist_ty_id ) ;
1919+ self . context . lower_node_id_with_owner ( def_node_id, self . opaque_ty_id ) ;
19201920 self . context . resolver . definitions ( ) . create_def_with_parent (
19211921 self . parent ,
19221922 def_node_id,
@@ -1952,7 +1952,7 @@ impl<'a> LoweringContext<'a> {
19521952 let mut lifetime_collector = ImplTraitLifetimeCollector {
19531953 context : self ,
19541954 parent : parent_index,
1955- exist_ty_id ,
1955+ opaque_ty_id ,
19561956 collect_elided_lifetimes : true ,
19571957 currently_bound_lifetimes : Vec :: new ( ) ,
19581958 already_defined_lifetimes : FxHashSet :: default ( ) ,
@@ -2582,40 +2582,40 @@ impl<'a> LoweringContext<'a> {
25822582 } )
25832583 }
25842584
2585- // Transforms `-> T` for `async fn` into `-> ExistTy { .. }`
2586- // combined with the following definition of `ExistTy `:
2585+ // Transforms `-> T` for `async fn` into `-> OpaqueTy { .. }`
2586+ // combined with the following definition of `OpaqueTy `:
25872587 //
2588- // type ExistTy <generics_from_parent_fn> = impl Future<Output = T>;
2588+ // type OpaqueTy <generics_from_parent_fn> = impl Future<Output = T>;
25892589 //
25902590 // `inputs`: lowered types of arguments to the function (used to collect lifetimes)
25912591 // `output`: unlowered output type (`T` in `-> T`)
25922592 // `fn_def_id`: `DefId` of the parent function (used to create child impl trait definition)
2593- // `exist_ty_node_id `: `NodeId` of the opaque `impl Trait` type that should be created
2593+ // `opaque_ty_node_id `: `NodeId` of the opaque `impl Trait` type that should be created
25942594 // `elided_lt_replacement`: replacement for elided lifetimes in the return type
25952595 fn lower_async_fn_ret_ty (
25962596 & mut self ,
25972597 output : & FunctionRetTy ,
25982598 fn_def_id : DefId ,
2599- exist_ty_node_id : NodeId ,
2599+ opaque_ty_node_id : NodeId ,
26002600 elided_lt_replacement : LtReplacement ,
26012601 ) -> hir:: FunctionRetTy {
26022602 let span = output. span ( ) ;
26032603
2604- let exist_ty_span = self . mark_span_with_reason (
2604+ let opaque_ty_span = self . mark_span_with_reason (
26052605 DesugaringKind :: Async ,
26062606 span,
26072607 None ,
26082608 ) ;
26092609
2610- let exist_ty_def_index = self
2610+ let opaque_ty_def_index = self
26112611 . resolver
26122612 . definitions ( )
2613- . opt_def_index ( exist_ty_node_id )
2613+ . opt_def_index ( opaque_ty_node_id )
26142614 . unwrap ( ) ;
26152615
2616- self . allocate_hir_id_counter ( exist_ty_node_id ) ;
2616+ self . allocate_hir_id_counter ( opaque_ty_node_id ) ;
26172617
2618- let ( exist_ty_id , lifetime_params) = self . with_hir_id_owner ( exist_ty_node_id , |this| {
2618+ let ( opaque_ty_id , lifetime_params) = self . with_hir_id_owner ( opaque_ty_node_id , |this| {
26192619 let future_bound = this. with_anonymous_lifetime_mode (
26202620 AnonymousLifetimeMode :: Replace ( elided_lt_replacement) ,
26212621 |this| this. lower_async_fn_output_type_to_future_bound (
@@ -2642,11 +2642,11 @@ impl<'a> LoweringContext<'a> {
26422642 lifetime_params
26432643 . iter ( ) . cloned ( )
26442644 . map ( |( span, hir_name) | {
2645- this. lifetime_to_generic_param ( span, hir_name, exist_ty_def_index )
2645+ this. lifetime_to_generic_param ( span, hir_name, opaque_ty_def_index )
26462646 } )
26472647 . collect ( ) ;
26482648
2649- let exist_ty_item = hir:: ExistTy {
2649+ let opaque_ty_item = hir:: OpaqueTy {
26502650 generics : hir:: Generics {
26512651 params : generic_params,
26522652 where_clause : hir:: WhereClause {
@@ -2660,15 +2660,15 @@ impl<'a> LoweringContext<'a> {
26602660 origin : hir:: OpaqueTyOrigin :: AsyncFn ,
26612661 } ;
26622662
2663- trace ! ( "exist ty from async fn def index: {:#?}" , exist_ty_def_index ) ;
2664- let exist_ty_id = this. generate_opaque_type (
2665- exist_ty_node_id ,
2666- exist_ty_item ,
2663+ trace ! ( "exist ty from async fn def index: {:#?}" , opaque_ty_def_index ) ;
2664+ let opaque_ty_id = this. generate_opaque_type (
2665+ opaque_ty_node_id ,
2666+ opaque_ty_item ,
26672667 span,
2668- exist_ty_span ,
2668+ opaque_ty_span ,
26692669 ) ;
26702670
2671- ( exist_ty_id , lifetime_params)
2671+ ( opaque_ty_id , lifetime_params)
26722672 } ) ;
26732673
26742674 let generic_args =
@@ -2683,10 +2683,10 @@ impl<'a> LoweringContext<'a> {
26832683 } )
26842684 . collect ( ) ;
26852685
2686- let exist_ty_ref = hir:: TyKind :: Def ( hir:: ItemId { id : exist_ty_id } , generic_args) ;
2686+ let opaque_ty_ref = hir:: TyKind :: Def ( hir:: ItemId { id : opaque_ty_id } , generic_args) ;
26872687
26882688 hir:: FunctionRetTy :: Return ( P ( hir:: Ty {
2689- node : exist_ty_ref ,
2689+ node : opaque_ty_ref ,
26902690 span,
26912691 hir_id : self . next_id ( ) ,
26922692 } ) )
@@ -3445,7 +3445,7 @@ impl<'a> LoweringContext<'a> {
34453445 self . lower_generics ( generics, ImplTraitContext :: disallowed ( ) ) ,
34463446 ) ,
34473447 ItemKind :: OpaqueTy ( ref b, ref generics) => hir:: ItemKind :: OpaqueTy (
3448- hir:: ExistTy {
3448+ hir:: OpaqueTy {
34493449 generics : self . lower_generics ( generics,
34503450 ImplTraitContext :: OpaqueTy ( None ) ) ,
34513451 bounds : self . lower_param_bounds ( b,
0 commit comments