@@ -254,16 +254,14 @@ fn clean_poly_trait_ref_with_bindings<'tcx>(
254
254
}
255
255
256
256
fn clean_lifetime < ' tcx > ( lifetime : & hir:: Lifetime , cx : & mut DocContext < ' tcx > ) -> Lifetime {
257
- let def = cx. tcx . named_bound_var ( lifetime. hir_id ) ;
258
257
if let Some (
259
- rbv:: ResolvedArg :: EarlyBound ( node_id)
260
- | rbv:: ResolvedArg :: LateBound ( _, _, node_id)
261
- | rbv:: ResolvedArg :: Free ( _, node_id) ,
262
- ) = def
258
+ rbv:: ResolvedArg :: EarlyBound ( did)
259
+ | rbv:: ResolvedArg :: LateBound ( _, _, did)
260
+ | rbv:: ResolvedArg :: Free ( _, did) ,
261
+ ) = cx. tcx . named_bound_var ( lifetime. hir_id )
262
+ && let Some ( lt) = cx. args . get ( & did) . and_then ( |arg| arg. as_lt ( ) )
263
263
{
264
- if let Some ( lt) = cx. args . get ( & node_id) . and_then ( |p| p. as_lt ( ) ) . cloned ( ) {
265
- return lt;
266
- }
264
+ return lt. clone ( ) ;
267
265
}
268
266
Lifetime ( lifetime. ident . name )
269
267
}
@@ -1791,12 +1789,12 @@ fn maybe_expand_private_type_alias<'tcx>(
1791
1789
_ => None ,
1792
1790
} ) ;
1793
1791
if let Some ( lt) = lifetime {
1794
- let cleaned = if !lt. is_anonymous ( ) {
1792
+ let lt = if !lt. is_anonymous ( ) {
1795
1793
clean_lifetime ( lt, cx)
1796
1794
} else {
1797
1795
Lifetime :: elided ( )
1798
1796
} ;
1799
- args. insert ( param. def_id . to_def_id ( ) , InstantiationParam :: Lifetime ( cleaned ) ) ;
1797
+ args. insert ( param. def_id . to_def_id ( ) , GenericArg :: Lifetime ( lt ) ) ;
1800
1798
}
1801
1799
indices. lifetimes += 1 ;
1802
1800
}
@@ -1805,44 +1803,20 @@ fn maybe_expand_private_type_alias<'tcx>(
1805
1803
let type_ = generic_args. args . iter ( ) . find_map ( |arg| match arg {
1806
1804
hir:: GenericArg :: Type ( ty) => {
1807
1805
if indices. types == j {
1808
- return Some ( ty) ;
1806
+ return Some ( * ty) ;
1809
1807
}
1810
1808
j += 1 ;
1811
1809
None
1812
1810
}
1813
1811
_ => None ,
1814
1812
} ) ;
1815
- if let Some ( ty) = type_ {
1816
- args. insert (
1817
- param. def_id . to_def_id ( ) ,
1818
- InstantiationParam :: Type ( clean_ty ( ty, cx) ) ,
1819
- ) ;
1820
- } else if let Some ( default) = * default {
1821
- args. insert (
1822
- param. def_id . to_def_id ( ) ,
1823
- InstantiationParam :: Type ( clean_ty ( default, cx) ) ,
1824
- ) ;
1813
+ if let Some ( ty) = type_. or ( * default) {
1814
+ args. insert ( param. def_id . to_def_id ( ) , GenericArg :: Type ( clean_ty ( ty, cx) ) ) ;
1825
1815
}
1826
1816
indices. types += 1 ;
1827
1817
}
1828
- hir:: GenericParamKind :: Const { .. } => {
1829
- let mut j = 0 ;
1830
- let const_ = generic_args. args . iter ( ) . find_map ( |arg| match arg {
1831
- hir:: GenericArg :: Const ( ct) => {
1832
- if indices. consts == j {
1833
- return Some ( ct) ;
1834
- }
1835
- j += 1 ;
1836
- None
1837
- }
1838
- _ => None ,
1839
- } ) ;
1840
- if let Some ( _) = const_ {
1841
- args. insert ( param. def_id . to_def_id ( ) , InstantiationParam :: Constant ) ;
1842
- }
1843
- // FIXME(const_generics_defaults)
1844
- indices. consts += 1 ;
1845
- }
1818
+ // FIXME(#82852): Instantiate const parameters.
1819
+ hir:: GenericParamKind :: Const { .. } => { }
1846
1820
}
1847
1821
}
1848
1822
0 commit comments