@@ -141,7 +141,7 @@ enum ResolutionError<'a> {
141141 /// error E0413: declaration shadows an enum variant or unit-like struct in scope
142142 DeclarationShadowsEnumVariantOrUnitLikeStruct ( Name ) ,
143143 /// error E0414: only irrefutable patterns allowed here
144- OnlyIrrefutablePatternsAllowedHere ( DefId , Name ) ,
144+ OnlyIrrefutablePatternsAllowedHere ( Name ) ,
145145 /// error E0415: identifier is bound more than once in this parameter list
146146 IdentifierBoundMoreThanOnceInParameterList ( & ' a str ) ,
147147 /// error E0416: identifier is bound more than once in the same pattern
@@ -323,22 +323,18 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
323323 or unit-like struct in scope",
324324 name)
325325 }
326- ResolutionError :: OnlyIrrefutablePatternsAllowedHere ( did , name) => {
326+ ResolutionError :: OnlyIrrefutablePatternsAllowedHere ( name) => {
327327 let mut err = struct_span_err ! ( resolver. session,
328328 span,
329329 E0414 ,
330330 "only irrefutable patterns allowed here" ) ;
331331 err. span_note ( span,
332332 "there already is a constant in scope sharing the same \
333333 name as this pattern") ;
334- if let Some ( sp) = resolver. ast_map . span_if_local ( did) {
335- err. span_note ( sp, "constant defined here" ) ;
336- }
337334 if let Some ( binding) = resolver. current_module
338335 . resolve_name_in_lexical_scope ( name, ValueNS ) {
339- if binding. is_import ( ) {
340- err. span_note ( binding. span , "constant imported here" ) ;
341- }
336+ let participle = if binding. is_import ( ) { "imported" } else { "defined" } ;
337+ err. span_note ( binding. span , & format ! ( "constant {} here" , participle) ) ;
342338 }
343339 err
344340 }
@@ -2248,12 +2244,11 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
22482244 depth : 0 ,
22492245 } ) ;
22502246 }
2251- FoundConst ( def , name) => {
2247+ FoundConst ( _ , name) => {
22522248 resolve_error (
22532249 self ,
22542250 pattern. span ,
2255- ResolutionError :: OnlyIrrefutablePatternsAllowedHere ( def. def_id ( ) ,
2256- name)
2251+ ResolutionError :: OnlyIrrefutablePatternsAllowedHere ( name)
22572252 ) ;
22582253 self . record_def ( pattern. id , err_path_resolution ( ) ) ;
22592254 }
0 commit comments