@@ -1488,6 +1488,9 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
14881488 // The only time this happens is if we're inside the rustdoc for Fn(),
14891489 // which only has one associated type, which is not a GAT, so whatever.
14901490 }
1491+ GenericArgs :: ReturnTypeNotation => {
1492+ // Never move these.
1493+ }
14911494 }
14921495 bounds. extend ( mem:: take ( pred_bounds) ) ;
14931496 false
@@ -2553,36 +2556,42 @@ fn clean_generic_args<'tcx>(
25532556 generic_args : & hir:: GenericArgs < ' tcx > ,
25542557 cx : & mut DocContext < ' tcx > ,
25552558) -> GenericArgs {
2556- // FIXME(return_type_notation): Fix RTN parens rendering
2557- if let Some ( ( inputs, output) ) = generic_args. paren_sugar_inputs_output ( ) {
2558- let inputs = inputs. iter ( ) . map ( |x| clean_ty ( x, cx) ) . collect ( ) ;
2559- let output = match output. kind {
2560- hir:: TyKind :: Tup ( & [ ] ) => None ,
2561- _ => Some ( Box :: new ( clean_ty ( output, cx) ) ) ,
2562- } ;
2563- GenericArgs :: Parenthesized { inputs, output }
2564- } else {
2565- let args = generic_args
2566- . args
2567- . iter ( )
2568- . map ( |arg| match arg {
2569- hir:: GenericArg :: Lifetime ( lt) if !lt. is_anonymous ( ) => {
2570- GenericArg :: Lifetime ( clean_lifetime ( lt, cx) )
2571- }
2572- hir:: GenericArg :: Lifetime ( _) => GenericArg :: Lifetime ( Lifetime :: elided ( ) ) ,
2573- hir:: GenericArg :: Type ( ty) => GenericArg :: Type ( clean_ty ( ty. as_unambig_ty ( ) , cx) ) ,
2574- hir:: GenericArg :: Const ( ct) => {
2575- GenericArg :: Const ( Box :: new ( clean_const ( ct. as_unambig_ct ( ) , cx) ) )
2576- }
2577- hir:: GenericArg :: Infer ( _inf) => GenericArg :: Infer ,
2578- } )
2579- . collect ( ) ;
2580- let constraints = generic_args
2581- . constraints
2582- . iter ( )
2583- . map ( |c| clean_assoc_item_constraint ( c, cx) )
2584- . collect :: < ThinVec < _ > > ( ) ;
2585- GenericArgs :: AngleBracketed { args, constraints }
2559+ match generic_args. parenthesized {
2560+ hir:: GenericArgsParentheses :: No => {
2561+ let args = generic_args
2562+ . args
2563+ . iter ( )
2564+ . map ( |arg| match arg {
2565+ hir:: GenericArg :: Lifetime ( lt) if !lt. is_anonymous ( ) => {
2566+ GenericArg :: Lifetime ( clean_lifetime ( lt, cx) )
2567+ }
2568+ hir:: GenericArg :: Lifetime ( _) => GenericArg :: Lifetime ( Lifetime :: elided ( ) ) ,
2569+ hir:: GenericArg :: Type ( ty) => GenericArg :: Type ( clean_ty ( ty. as_unambig_ty ( ) , cx) ) ,
2570+ hir:: GenericArg :: Const ( ct) => {
2571+ GenericArg :: Const ( Box :: new ( clean_const ( ct. as_unambig_ct ( ) , cx) ) )
2572+ }
2573+ hir:: GenericArg :: Infer ( _inf) => GenericArg :: Infer ,
2574+ } )
2575+ . collect ( ) ;
2576+ let constraints = generic_args
2577+ . constraints
2578+ . iter ( )
2579+ . map ( |c| clean_assoc_item_constraint ( c, cx) )
2580+ . collect :: < ThinVec < _ > > ( ) ;
2581+ GenericArgs :: AngleBracketed { args, constraints }
2582+ }
2583+ hir:: GenericArgsParentheses :: ParenSugar => {
2584+ let Some ( ( inputs, output) ) = generic_args. paren_sugar_inputs_output ( ) else {
2585+ bug ! ( ) ;
2586+ } ;
2587+ let inputs = inputs. iter ( ) . map ( |x| clean_ty ( x, cx) ) . collect ( ) ;
2588+ let output = match output. kind {
2589+ hir:: TyKind :: Tup ( & [ ] ) => None ,
2590+ _ => Some ( Box :: new ( clean_ty ( output, cx) ) ) ,
2591+ } ;
2592+ GenericArgs :: Parenthesized { inputs, output }
2593+ }
2594+ hir:: GenericArgsParentheses :: ReturnTypeNotation => GenericArgs :: ReturnTypeNotation ,
25862595 }
25872596}
25882597
0 commit comments