@@ -274,39 +274,35 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
274274 // input. We try to handle both sensibly.
275275 ' args: for arg in & generic_args. args {
276276 while let Some ( param) = next_param {
277- match param. kind {
278- GenericParamDefKind :: Lifetime => match arg {
279- GenericArg :: Lifetime ( _) => {
280- push_kind ( & mut substs, provided_kind ( param, arg) ) ;
281- next_param = params. next ( ) ;
282- continue ' args;
283- }
284- GenericArg :: Type ( _) => {
285- // We expected a lifetime argument, but got a type
286- // argument. That means we're inferring the lifetimes.
287- push_kind ( & mut substs, inferred_kind ( None , param, infer_types) ) ;
288- next_param = params. next ( ) ;
289- }
277+ match ( & param. kind , arg) {
278+ ( GenericParamDefKind :: Lifetime , GenericArg :: Lifetime ( _) ) => {
279+ push_kind ( & mut substs, provided_kind ( param, arg) ) ;
280+ next_param = params. next ( ) ;
281+ continue ' args;
290282 }
291- GenericParamDefKind :: Type { .. } => match arg {
292- GenericArg :: Type ( _) => {
293- push_kind ( & mut substs, provided_kind ( param, arg) ) ;
294- next_param = params. next ( ) ;
295- continue ' args;
296- }
297- GenericArg :: Lifetime ( _) => {
298- // We expected a type argument, but got a lifetime
299- // argument. This is an error, but we need to handle it
300- // gracefully so we can report sensible errors. In this
301- // case, we're simply going to infer the remaining
302- // arguments.
303- if err_if_invalid {
304- tcx. sess . delay_span_bug ( span,
305- "found a GenericArg::Lifetime where a \
306- GenericArg::Type was expected") ;
307- }
308- break ' args;
283+ ( GenericParamDefKind :: Lifetime , GenericArg :: Type ( _) ) => {
284+ // We expected a lifetime argument, but got a type
285+ // argument. That means we're inferring the lifetimes.
286+ push_kind ( & mut substs, inferred_kind ( None , param, infer_types) ) ;
287+ next_param = params. next ( ) ;
288+ }
289+ ( GenericParamDefKind :: Type { .. } , GenericArg :: Type ( _) ) => {
290+ push_kind ( & mut substs, provided_kind ( param, arg) ) ;
291+ next_param = params. next ( ) ;
292+ continue ' args;
293+ }
294+ ( GenericParamDefKind :: Type { .. } , GenericArg :: Lifetime ( _) ) => {
295+ // We expected a type argument, but got a lifetime
296+ // argument. This is an error, but we need to handle it
297+ // gracefully so we can report sensible errors. In this
298+ // case, we're simply going to infer the remaining
299+ // arguments.
300+ if err_if_invalid {
301+ tcx. sess . delay_span_bug ( span,
302+ "found a GenericArg::Lifetime where a \
303+ GenericArg::Type was expected") ;
309304 }
305+ break ' args;
310306 }
311307 }
312308 }
0 commit comments