@@ -254,16 +254,14 @@ fn clean_poly_trait_ref_with_bindings<'tcx>(
254254}
255255
256256fn clean_lifetime < ' tcx > ( lifetime : & hir:: Lifetime , cx : & mut DocContext < ' tcx > ) -> Lifetime {
257- let def = cx. tcx . named_bound_var ( lifetime. hir_id ) ;
258257 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 ( ) )
263263 {
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 ( ) ;
267265 }
268266 Lifetime ( lifetime. ident . name )
269267}
@@ -1791,12 +1789,12 @@ fn maybe_expand_private_type_alias<'tcx>(
17911789 _ => None ,
17921790 } ) ;
17931791 if let Some ( lt) = lifetime {
1794- let cleaned = if !lt. is_anonymous ( ) {
1792+ let lt = if !lt. is_anonymous ( ) {
17951793 clean_lifetime ( lt, cx)
17961794 } else {
17971795 Lifetime :: elided ( )
17981796 } ;
1799- args. insert ( param. def_id . to_def_id ( ) , InstantiationParam :: Lifetime ( cleaned ) ) ;
1797+ args. insert ( param. def_id . to_def_id ( ) , GenericArg :: Lifetime ( lt ) ) ;
18001798 }
18011799 indices. lifetimes += 1 ;
18021800 }
@@ -1805,44 +1803,20 @@ fn maybe_expand_private_type_alias<'tcx>(
18051803 let type_ = generic_args. args . iter ( ) . find_map ( |arg| match arg {
18061804 hir:: GenericArg :: Type ( ty) => {
18071805 if indices. types == j {
1808- return Some ( ty) ;
1806+ return Some ( * ty) ;
18091807 }
18101808 j += 1 ;
18111809 None
18121810 }
18131811 _ => None ,
18141812 } ) ;
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) ) ) ;
18251815 }
18261816 indices. types += 1 ;
18271817 }
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 { .. } => { }
18461820 }
18471821 }
18481822
0 commit comments