@@ -1721,38 +1721,38 @@ impl<'a> LoweringContext<'a> {
1721
1721
& mut self ,
1722
1722
span : Span ,
1723
1723
fn_def_id : Option < DefId > ,
1724
- exist_ty_node_id : NodeId ,
1724
+ opaque_ty_node_id : NodeId ,
1725
1725
lower_bounds : impl FnOnce ( & mut LoweringContext < ' _ > ) -> hir:: GenericBounds ,
1726
1726
) -> hir:: TyKind {
1727
1727
// Make sure we know that some funky desugaring has been going on here.
1728
1728
// This is a first: there is code in other places like for loop
1729
1729
// desugaring that explicitly states that we don't want to track that.
1730
1730
// Not tracking it makes lints in rustc and clippy very fragile, as
1731
1731
// frequently opened issues show.
1732
- let exist_ty_span = self . mark_span_with_reason (
1732
+ let opaque_ty_span = self . mark_span_with_reason (
1733
1733
DesugaringKind :: OpaqueTy ,
1734
1734
span,
1735
1735
None ,
1736
1736
) ;
1737
1737
1738
- let exist_ty_def_index = self
1738
+ let opaque_ty_def_index = self
1739
1739
. resolver
1740
1740
. definitions ( )
1741
- . opt_def_index ( exist_ty_node_id )
1741
+ . opt_def_index ( opaque_ty_node_id )
1742
1742
. unwrap ( ) ;
1743
1743
1744
- self . allocate_hir_id_counter ( exist_ty_node_id ) ;
1744
+ self . allocate_hir_id_counter ( opaque_ty_node_id ) ;
1745
1745
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) ;
1747
1747
1748
1748
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 ,
1751
1751
& hir_bounds,
1752
1752
) ;
1753
1753
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 {
1756
1756
generics : hir:: Generics {
1757
1757
params : lifetime_defs,
1758
1758
where_clause : hir:: WhereClause {
@@ -1766,51 +1766,51 @@ impl<'a> LoweringContext<'a> {
1766
1766
origin : hir:: OpaqueTyOrigin :: ReturnImplTrait ,
1767
1767
} ;
1768
1768
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 ,
1773
1773
span,
1774
- exist_ty_span ,
1774
+ opaque_ty_span ,
1775
1775
) ;
1776
1776
1777
1777
// `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)
1779
1779
} )
1780
1780
}
1781
1781
1782
1782
/// Registers a new opaque type with the proper `NodeId`s and
1783
1783
/// returns the lowered node-ID for the opaque type.
1784
1784
fn generate_opaque_type (
1785
1785
& 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 ,
1788
1788
span : Span ,
1789
- exist_ty_span : Span ,
1789
+ opaque_ty_span : Span ,
1790
1790
) -> 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 ) ;
1793
1793
// 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 ,
1797
1797
ident : Ident :: invalid ( ) ,
1798
1798
attrs : Default :: default ( ) ,
1799
- node : exist_ty_item_kind ,
1799
+ node : opaque_ty_item_kind ,
1800
1800
vis : respan ( span. shrink_to_lo ( ) , hir:: VisibilityKind :: Inherited ) ,
1801
- span : exist_ty_span ,
1801
+ span : opaque_ty_span ,
1802
1802
} ;
1803
1803
1804
1804
// Insert the item into the global item list. This usually happens
1805
1805
// automatically for all AST items. But this opaque type item
1806
1806
// 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
1809
1809
}
1810
1810
1811
1811
fn lifetimes_from_impl_trait_bounds (
1812
1812
& mut self ,
1813
- exist_ty_id : NodeId ,
1813
+ opaque_ty_id : NodeId ,
1814
1814
parent_index : DefIndex ,
1815
1815
bounds : & hir:: GenericBounds ,
1816
1816
) -> ( HirVec < hir:: GenericArg > , HirVec < hir:: GenericParam > ) {
@@ -1820,7 +1820,7 @@ impl<'a> LoweringContext<'a> {
1820
1820
struct ImplTraitLifetimeCollector < ' r , ' a > {
1821
1821
context : & ' r mut LoweringContext < ' a > ,
1822
1822
parent : DefIndex ,
1823
- exist_ty_id : NodeId ,
1823
+ opaque_ty_id : NodeId ,
1824
1824
collect_elided_lifetimes : bool ,
1825
1825
currently_bound_lifetimes : Vec < hir:: LifetimeName > ,
1826
1826
already_defined_lifetimes : FxHashSet < hir:: LifetimeName > ,
@@ -1916,7 +1916,7 @@ impl<'a> LoweringContext<'a> {
1916
1916
1917
1917
let def_node_id = self . context . sess . next_node_id ( ) ;
1918
1918
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 ) ;
1920
1920
self . context . resolver . definitions ( ) . create_def_with_parent (
1921
1921
self . parent ,
1922
1922
def_node_id,
@@ -1952,7 +1952,7 @@ impl<'a> LoweringContext<'a> {
1952
1952
let mut lifetime_collector = ImplTraitLifetimeCollector {
1953
1953
context : self ,
1954
1954
parent : parent_index,
1955
- exist_ty_id ,
1955
+ opaque_ty_id ,
1956
1956
collect_elided_lifetimes : true ,
1957
1957
currently_bound_lifetimes : Vec :: new ( ) ,
1958
1958
already_defined_lifetimes : FxHashSet :: default ( ) ,
@@ -2582,40 +2582,40 @@ impl<'a> LoweringContext<'a> {
2582
2582
} )
2583
2583
}
2584
2584
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 `:
2587
2587
//
2588
- // type ExistTy <generics_from_parent_fn> = impl Future<Output = T>;
2588
+ // type OpaqueTy <generics_from_parent_fn> = impl Future<Output = T>;
2589
2589
//
2590
2590
// `inputs`: lowered types of arguments to the function (used to collect lifetimes)
2591
2591
// `output`: unlowered output type (`T` in `-> T`)
2592
2592
// `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
2594
2594
// `elided_lt_replacement`: replacement for elided lifetimes in the return type
2595
2595
fn lower_async_fn_ret_ty (
2596
2596
& mut self ,
2597
2597
output : & FunctionRetTy ,
2598
2598
fn_def_id : DefId ,
2599
- exist_ty_node_id : NodeId ,
2599
+ opaque_ty_node_id : NodeId ,
2600
2600
elided_lt_replacement : LtReplacement ,
2601
2601
) -> hir:: FunctionRetTy {
2602
2602
let span = output. span ( ) ;
2603
2603
2604
- let exist_ty_span = self . mark_span_with_reason (
2604
+ let opaque_ty_span = self . mark_span_with_reason (
2605
2605
DesugaringKind :: Async ,
2606
2606
span,
2607
2607
None ,
2608
2608
) ;
2609
2609
2610
- let exist_ty_def_index = self
2610
+ let opaque_ty_def_index = self
2611
2611
. resolver
2612
2612
. definitions ( )
2613
- . opt_def_index ( exist_ty_node_id )
2613
+ . opt_def_index ( opaque_ty_node_id )
2614
2614
. unwrap ( ) ;
2615
2615
2616
- self . allocate_hir_id_counter ( exist_ty_node_id ) ;
2616
+ self . allocate_hir_id_counter ( opaque_ty_node_id ) ;
2617
2617
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| {
2619
2619
let future_bound = this. with_anonymous_lifetime_mode (
2620
2620
AnonymousLifetimeMode :: Replace ( elided_lt_replacement) ,
2621
2621
|this| this. lower_async_fn_output_type_to_future_bound (
@@ -2642,11 +2642,11 @@ impl<'a> LoweringContext<'a> {
2642
2642
lifetime_params
2643
2643
. iter ( ) . cloned ( )
2644
2644
. 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 )
2646
2646
} )
2647
2647
. collect ( ) ;
2648
2648
2649
- let exist_ty_item = hir:: ExistTy {
2649
+ let opaque_ty_item = hir:: OpaqueTy {
2650
2650
generics : hir:: Generics {
2651
2651
params : generic_params,
2652
2652
where_clause : hir:: WhereClause {
@@ -2660,15 +2660,15 @@ impl<'a> LoweringContext<'a> {
2660
2660
origin : hir:: OpaqueTyOrigin :: AsyncFn ,
2661
2661
} ;
2662
2662
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 ,
2667
2667
span,
2668
- exist_ty_span ,
2668
+ opaque_ty_span ,
2669
2669
) ;
2670
2670
2671
- ( exist_ty_id , lifetime_params)
2671
+ ( opaque_ty_id , lifetime_params)
2672
2672
} ) ;
2673
2673
2674
2674
let generic_args =
@@ -2683,10 +2683,10 @@ impl<'a> LoweringContext<'a> {
2683
2683
} )
2684
2684
. collect ( ) ;
2685
2685
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) ;
2687
2687
2688
2688
hir:: FunctionRetTy :: Return ( P ( hir:: Ty {
2689
- node : exist_ty_ref ,
2689
+ node : opaque_ty_ref ,
2690
2690
span,
2691
2691
hir_id : self . next_id ( ) ,
2692
2692
} ) )
@@ -3445,7 +3445,7 @@ impl<'a> LoweringContext<'a> {
3445
3445
self . lower_generics ( generics, ImplTraitContext :: disallowed ( ) ) ,
3446
3446
) ,
3447
3447
ItemKind :: OpaqueTy ( ref b, ref generics) => hir:: ItemKind :: OpaqueTy (
3448
- hir:: ExistTy {
3448
+ hir:: OpaqueTy {
3449
3449
generics : self . lower_generics ( generics,
3450
3450
ImplTraitContext :: OpaqueTy ( None ) ) ,
3451
3451
bounds : self . lower_param_bounds ( b,
0 commit comments