From e4b8ed5aff7d25aa21c4c4d6bba8850c6dcaaaac Mon Sep 17 00:00:00 2001 From: Ellen Date: Fri, 6 May 2022 11:40:18 +0100 Subject: [PATCH] move closure down --- .../rustc_typeck/src/check/compare_method.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_typeck/src/check/compare_method.rs b/compiler/rustc_typeck/src/check/compare_method.rs index 3e15079552c..a83924d4636 100644 --- a/compiler/rustc_typeck/src/check/compare_method.rs +++ b/compiler/rustc_typeck/src/check/compare_method.rs @@ -1001,14 +1001,6 @@ fn compare_generic_param_kinds<'tcx>( (Const { .. }, Const { .. }) | (Type { .. }, Type { .. }) => false, (Lifetime { .. }, _) | (_, Lifetime { .. }) => unreachable!(), } { - let make_param_message = |prefix: &str, param: &ty::GenericParamDef| match param.kind { - Const { .. } => { - format!("{} const parameter of type `{}`", prefix, tcx.type_of(param.def_id)) - } - Type { .. } => format!("{} type parameter", prefix), - Lifetime { .. } => unreachable!(), - }; - let param_impl_span = tcx.def_span(param_impl.def_id); let param_trait_span = tcx.def_span(param_trait.def_id); @@ -1022,6 +1014,14 @@ fn compare_generic_param_kinds<'tcx>( &tcx.def_path_str(tcx.parent(trait_item.def_id)) ); + let make_param_message = |prefix: &str, param: &ty::GenericParamDef| match param.kind { + Const { .. } => { + format!("{} const parameter of type `{}`", prefix, tcx.type_of(param.def_id)) + } + Type { .. } => format!("{} type parameter", prefix), + Lifetime { .. } => unreachable!(), + }; + let trait_header_span = tcx.def_ident_span(tcx.parent(trait_item.def_id)).unwrap(); err.span_label(trait_header_span, ""); err.span_label(param_trait_span, make_param_message("expected", param_trait));