@@ -323,7 +323,7 @@ enum ParenthesizedGenericArgs {
323
323
/// `resolve_lifetime` module. Often we "fallthrough" to that code by generating
324
324
/// an "elided" or "underscore" lifetime name. In the future, we probably want to move
325
325
/// everything into HIR lowering.
326
- #[ derive( Copy , Clone ) ]
326
+ #[ derive( Copy , Clone , Debug ) ]
327
327
enum AnonymousLifetimeMode {
328
328
/// For **Modern** cases, create a new anonymous region parameter
329
329
/// and reference that.
@@ -361,7 +361,7 @@ enum AnonymousLifetimeMode {
361
361
}
362
362
363
363
/// The type of elided lifetime replacement to perform on `async fn` return types.
364
- #[ derive( Copy , Clone ) ]
364
+ #[ derive( Copy , Clone , Debug ) ]
365
365
enum LtReplacement {
366
366
/// Fresh name introduced by the single non-dyn elided lifetime
367
367
/// in the arguments of the async fn.
@@ -890,10 +890,16 @@ impl<'a> LoweringContext<'a> {
890
890
anonymous_lifetime_mode : AnonymousLifetimeMode ,
891
891
op : impl FnOnce ( & mut Self ) -> R ,
892
892
) -> R {
893
+ debug ! (
894
+ "with_anonymous_lifetime_mode(anonymous_lifetime_mode={:?})" ,
895
+ anonymous_lifetime_mode,
896
+ ) ;
893
897
let old_anonymous_lifetime_mode = self . anonymous_lifetime_mode ;
894
898
self . anonymous_lifetime_mode = anonymous_lifetime_mode;
895
899
let result = op ( self ) ;
896
900
self . anonymous_lifetime_mode = old_anonymous_lifetime_mode;
901
+ debug ! ( "with_anonymous_lifetime_mode: restoring anonymous_lifetime_mode={:?}" ,
902
+ old_anonymous_lifetime_mode) ;
897
903
result
898
904
}
899
905
@@ -1731,6 +1737,13 @@ impl<'a> LoweringContext<'a> {
1731
1737
opaque_ty_node_id : NodeId ,
1732
1738
lower_bounds : impl FnOnce ( & mut LoweringContext < ' _ > ) -> hir:: GenericBounds ,
1733
1739
) -> hir:: TyKind {
1740
+ debug ! (
1741
+ "lower_opaque_impl_trait(fn_def_id={:?}, opaque_ty_node_id={:?}, span={:?})" ,
1742
+ fn_def_id,
1743
+ opaque_ty_node_id,
1744
+ span,
1745
+ ) ;
1746
+
1734
1747
// Make sure we know that some funky desugaring has been going on here.
1735
1748
// This is a first: there is code in other places like for loop
1736
1749
// desugaring that explicitly states that we don't want to track that.
@@ -1758,6 +1771,14 @@ impl<'a> LoweringContext<'a> {
1758
1771
& hir_bounds,
1759
1772
) ;
1760
1773
1774
+ debug ! (
1775
+ "lower_opaque_impl_trait: lifetimes={:#?}" , lifetimes,
1776
+ ) ;
1777
+
1778
+ debug ! (
1779
+ "lower_opaque_impl_trait: lifetime_defs={:#?}" , lifetime_defs,
1780
+ ) ;
1781
+
1761
1782
self . with_hir_id_owner ( opaque_ty_node_id, |lctx| {
1762
1783
let opaque_ty_item = hir:: OpaqueTy {
1763
1784
generics : hir:: Generics {
@@ -1773,7 +1794,7 @@ impl<'a> LoweringContext<'a> {
1773
1794
origin : hir:: OpaqueTyOrigin :: FnReturn ,
1774
1795
} ;
1775
1796
1776
- trace ! ( "exist ty from impl trait def-index : {:#?}" , opaque_ty_def_index) ;
1797
+ trace ! ( "lower_opaque_impl_trait : {:#?}" , opaque_ty_def_index) ;
1777
1798
let opaque_ty_id = lctx. generate_opaque_type (
1778
1799
opaque_ty_node_id,
1779
1800
opaque_ty_item,
@@ -1821,6 +1842,13 @@ impl<'a> LoweringContext<'a> {
1821
1842
parent_index : DefIndex ,
1822
1843
bounds : & hir:: GenericBounds ,
1823
1844
) -> ( HirVec < hir:: GenericArg > , HirVec < hir:: GenericParam > ) {
1845
+ debug ! (
1846
+ "lifetimes_from_impl_trait_bounds(opaque_ty_id={:?}, \
1847
+ parent_index={:?}, \
1848
+ bounds={:#?})",
1849
+ opaque_ty_id, parent_index, bounds,
1850
+ ) ;
1851
+
1824
1852
// This visitor walks over `impl Trait` bounds and creates defs for all lifetimes that
1825
1853
// appear in the bounds, excluding lifetimes that are created within the bounds.
1826
1854
// E.g., `'a`, `'b`, but not `'c` in `impl for<'c> SomeTrait<'a, 'b, 'c>`.
@@ -2606,6 +2634,15 @@ impl<'a> LoweringContext<'a> {
2606
2634
opaque_ty_node_id : NodeId ,
2607
2635
elided_lt_replacement : LtReplacement ,
2608
2636
) -> hir:: FunctionRetTy {
2637
+ debug ! (
2638
+ "lower_async_fn_ret_ty(\
2639
+ output={:?}, \
2640
+ fn_def_id={:?}, \
2641
+ opaque_ty_node_id={:?}, \
2642
+ elided_lt_replacement={:?})",
2643
+ output, fn_def_id, opaque_ty_node_id, elided_lt_replacement,
2644
+ ) ;
2645
+
2609
2646
let span = output. span ( ) ;
2610
2647
2611
2648
let opaque_ty_span = self . mark_span_with_reason (
@@ -2632,6 +2669,8 @@ impl<'a> LoweringContext<'a> {
2632
2669
) ,
2633
2670
) ;
2634
2671
2672
+ debug ! ( "lower_async_fn_ret_ty: future_bound={:#?}" , future_bound) ;
2673
+
2635
2674
// Calculate all the lifetimes that should be captured
2636
2675
// by the opaque type. This should include all in-scope
2637
2676
// lifetime parameters, including those defined in-band.
0 commit comments