@@ -1480,6 +1480,9 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
14801480 // The only time this happens is if we're inside the rustdoc for Fn(),
14811481 // which only has one associated type, which is not a GAT, so whatever.
14821482 }
1483+ GenericArgs :: ReturnTypeNotation => {
1484+ // Never move these.
1485+ }
14831486 }
14841487 bounds. extend ( mem:: take ( pred_bounds) ) ;
14851488 false
@@ -2537,37 +2540,43 @@ fn clean_generic_args<'tcx>(
25372540 generic_args : & hir:: GenericArgs < ' tcx > ,
25382541 cx : & mut DocContext < ' tcx > ,
25392542) -> GenericArgs {
2540- // FIXME(return_type_notation): Fix RTN parens rendering
2541- if let Some ( ( inputs, output) ) = generic_args. paren_sugar_inputs_output ( ) {
2542- let inputs = inputs. iter ( ) . map ( |x| clean_ty ( x, cx) ) . collect :: < ThinVec < _ > > ( ) . into ( ) ;
2543- let output = match output. kind {
2544- hir:: TyKind :: Tup ( & [ ] ) => None ,
2545- _ => Some ( Box :: new ( clean_ty ( output, cx) ) ) ,
2546- } ;
2547- GenericArgs :: Parenthesized { inputs, output }
2548- } else {
2549- let args = generic_args
2550- . args
2551- . iter ( )
2552- . map ( |arg| match arg {
2553- hir:: GenericArg :: Lifetime ( lt) if !lt. is_anonymous ( ) => {
2554- GenericArg :: Lifetime ( clean_lifetime ( lt, cx) )
2555- }
2556- hir:: GenericArg :: Lifetime ( _) => GenericArg :: Lifetime ( Lifetime :: elided ( ) ) ,
2557- hir:: GenericArg :: Type ( ty) => GenericArg :: Type ( clean_ty ( ty. as_unambig_ty ( ) , cx) ) ,
2558- hir:: GenericArg :: Const ( ct) => {
2559- GenericArg :: Const ( Box :: new ( clean_const ( ct. as_unambig_ct ( ) , cx) ) )
2560- }
2561- hir:: GenericArg :: Infer ( _inf) => GenericArg :: Infer ,
2562- } )
2563- . collect :: < ThinVec < _ > > ( )
2564- . into ( ) ;
2565- let constraints = generic_args
2566- . constraints
2567- . iter ( )
2568- . map ( |c| clean_assoc_item_constraint ( c, cx) )
2569- . collect :: < ThinVec < _ > > ( ) ;
2570- GenericArgs :: AngleBracketed { args, constraints }
2543+ match generic_args. parenthesized {
2544+ hir:: GenericArgsParentheses :: No => {
2545+ let args = generic_args
2546+ . args
2547+ . iter ( )
2548+ . map ( |arg| match arg {
2549+ hir:: GenericArg :: Lifetime ( lt) if !lt. is_anonymous ( ) => {
2550+ GenericArg :: Lifetime ( clean_lifetime ( lt, cx) )
2551+ }
2552+ hir:: GenericArg :: Lifetime ( _) => GenericArg :: Lifetime ( Lifetime :: elided ( ) ) ,
2553+ hir:: GenericArg :: Type ( ty) => GenericArg :: Type ( clean_ty ( ty. as_unambig_ty ( ) , cx) ) ,
2554+ hir:: GenericArg :: Const ( ct) => {
2555+ GenericArg :: Const ( Box :: new ( clean_const ( ct. as_unambig_ct ( ) , cx) ) )
2556+ }
2557+ hir:: GenericArg :: Infer ( _inf) => GenericArg :: Infer ,
2558+ } )
2559+ . collect :: < ThinVec < _ > > ( )
2560+ . into ( ) ;
2561+ let constraints = generic_args
2562+ . constraints
2563+ . iter ( )
2564+ . map ( |c| clean_assoc_item_constraint ( c, cx) )
2565+ . collect :: < ThinVec < _ > > ( ) ;
2566+ GenericArgs :: AngleBracketed { args, constraints }
2567+ }
2568+ hir:: GenericArgsParentheses :: ParenSugar => {
2569+ let Some ( ( inputs, output) ) = generic_args. paren_sugar_inputs_output ( ) else {
2570+ bug ! ( ) ;
2571+ } ;
2572+ let inputs = inputs. iter ( ) . map ( |x| clean_ty ( x, cx) ) . collect :: < ThinVec < _ > > ( ) . into ( ) ;
2573+ let output = match output. kind {
2574+ hir:: TyKind :: Tup ( & [ ] ) => None ,
2575+ _ => Some ( Box :: new ( clean_ty ( output, cx) ) ) ,
2576+ } ;
2577+ GenericArgs :: Parenthesized { inputs, output }
2578+ }
2579+ hir:: GenericArgsParentheses :: ReturnTypeNotation => GenericArgs :: ReturnTypeNotation ,
25712580 }
25722581}
25732582
0 commit comments