@@ -553,14 +553,14 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
553553 resolution_error : ResolutionError < ' a > ,
554554 ) -> DiagnosticBuilder < ' _ , ErrorGuaranteed > {
555555 match resolution_error {
556- ResolutionError :: GenericParamsFromOuterFunction ( outer_res, has_generic_params) => {
556+ ResolutionError :: GenericParamsFromOuterItem ( outer_res, has_generic_params) => {
557557 let mut err = struct_span_err ! (
558558 self . tcx. sess,
559559 span,
560560 E0401 ,
561- "can't use generic parameters from outer function " ,
561+ "can't use generic parameters from outer item " ,
562562 ) ;
563- err. span_label ( span, "use of generic parameter from outer function " ) ;
563+ err. span_label ( span, "use of generic parameter from outer item " ) ;
564564
565565 let sm = self . tcx . sess . source_map ( ) ;
566566 let def_id = match outer_res {
@@ -573,33 +573,28 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
573573 reduce_impl_span_to_impl_keyword ( sm, self . def_span ( def_id) ) ,
574574 "`Self` type implicitly declared here, by this `impl`" ,
575575 ) ;
576- err. span_label ( span, "use a type here instead" ) ;
576+ err. span_label ( span, "refer to the type directly here instead" ) ;
577577 return err;
578578 }
579579 Res :: Def ( DefKind :: TyParam , def_id) => {
580- err. span_label ( self . def_span ( def_id) , "type parameter from outer function " ) ;
580+ err. span_label ( self . def_span ( def_id) , "type parameter from outer item " ) ;
581581 def_id
582582 }
583583 Res :: Def ( DefKind :: ConstParam , def_id) => {
584- err. span_label (
585- self . def_span ( def_id) ,
586- "const parameter from outer function" ,
587- ) ;
584+ err. span_label ( self . def_span ( def_id) , "const parameter from outer item" ) ;
588585 def_id
589586 }
590587 _ => {
591588 bug ! (
592- "GenericParamsFromOuterFunction should only be used with \
589+ "GenericParamsFromOuterItem should only be used with \
593590 Res::SelfTyParam, Res::SelfTyAlias, DefKind::TyParam or \
594591 DefKind::ConstParam"
595592 ) ;
596593 }
597594 } ;
598595
599596 if let HasGenericParams :: Yes ( span) = has_generic_params {
600- // Try to retrieve the span of the function signature and generate a new
601- // message with a local type or const parameter.
602- let sugg_msg = "try using a local generic parameter instead" ;
597+ let sugg_msg = "try introducing a local generic parameter here" ;
603598 let name = self . tcx . item_name ( def_id) ;
604599 let ( span, snippet) = if span. is_empty ( ) {
605600 let snippet = format ! ( "<{name}>" ) ;
@@ -609,7 +604,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
609604 let snippet = format ! ( "{name}, " ) ;
610605 ( span, snippet)
611606 } ;
612- // Suggest the modification to the user
613607 err. span_suggestion ( span, sugg_msg, snippet, Applicability :: MaybeIncorrect ) ;
614608 }
615609
0 commit comments