@@ -203,7 +203,6 @@ fn check_associated_item(
203203 fcx. register_wf_obligation ( ty, span, code. clone ( ) ) ;
204204 }
205205 ty:: AssocKind :: Method => {
206- reject_shadowing_parameters ( fcx. tcx , item. def_id ) ;
207206 let sig = fcx. tcx . fn_sig ( item. def_id ) ;
208207 let sig = fcx. normalize_associated_types_in ( span, & sig) ;
209208 check_fn_or_method ( tcx, fcx, span, sig,
@@ -998,34 +997,6 @@ fn report_bivariance(tcx: TyCtxt<'_>, span: Span, param_name: ast::Name) {
998997 err. emit ( ) ;
999998}
1000999
1001- fn reject_shadowing_parameters ( tcx : TyCtxt < ' _ > , def_id : DefId ) {
1002- let generics = tcx. generics_of ( def_id) ;
1003- let parent = tcx. generics_of ( generics. parent . unwrap ( ) ) ;
1004- let impl_params: FxHashMap < _ , _ > = parent. params . iter ( ) . flat_map ( |param| match param. kind {
1005- GenericParamDefKind :: Lifetime => None ,
1006- GenericParamDefKind :: Type { .. } | GenericParamDefKind :: Const => {
1007- Some ( ( param. name , param. def_id ) )
1008- }
1009- } ) . collect ( ) ;
1010-
1011- for method_param in & generics. params {
1012- // Shadowing is checked in `resolve_lifetime`.
1013- if let GenericParamDefKind :: Lifetime = method_param. kind {
1014- continue
1015- }
1016- if impl_params. contains_key ( & method_param. name ) {
1017- // Tighten up the span to focus on only the shadowing type.
1018- let type_span = tcx. def_span ( method_param. def_id ) ;
1019-
1020- // The expectation here is that the original trait declaration is
1021- // local so it should be okay to just unwrap everything.
1022- let trait_def_id = impl_params[ & method_param. name ] ;
1023- let trait_decl_span = tcx. def_span ( trait_def_id) ;
1024- error_194 ( tcx, type_span, trait_decl_span, & method_param. name . as_str ( ) [ ..] ) ;
1025- }
1026- }
1027- }
1028-
10291000/// Feature gates RFC 2056 -- trivial bounds, checking for global bounds that
10301001/// aren't true.
10311002fn check_false_global_bounds ( fcx : & FnCtxt < ' _ , ' _ > , span : Span , id : hir:: HirId ) {
@@ -1152,12 +1123,3 @@ fn error_392(
11521123 err. span_label ( span, "unused parameter" ) ;
11531124 err
11541125}
1155-
1156- fn error_194 ( tcx : TyCtxt < ' _ > , span : Span , trait_decl_span : Span , name : & str ) {
1157- struct_span_err ! ( tcx. sess, span, E0194 ,
1158- "type parameter `{}` shadows another type parameter of the same name" ,
1159- name)
1160- . span_label ( span, "shadows another type parameter" )
1161- . span_label ( trait_decl_span, format ! ( "first `{}` declared here" , name) )
1162- . emit ( ) ;
1163- }
0 commit comments