@@ -141,7 +141,7 @@ enum ResolutionError<'a> {
141
141
/// error E0413: declaration shadows an enum variant or unit-like struct in scope
142
142
DeclarationShadowsEnumVariantOrUnitLikeStruct ( Name ) ,
143
143
/// error E0414: only irrefutable patterns allowed here
144
- OnlyIrrefutablePatternsAllowedHere ( DefId , Name ) ,
144
+ OnlyIrrefutablePatternsAllowedHere ( Name ) ,
145
145
/// error E0415: identifier is bound more than once in this parameter list
146
146
IdentifierBoundMoreThanOnceInParameterList ( & ' a str ) ,
147
147
/// 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>,
323
323
or unit-like struct in scope",
324
324
name)
325
325
}
326
- ResolutionError :: OnlyIrrefutablePatternsAllowedHere ( did , name) => {
326
+ ResolutionError :: OnlyIrrefutablePatternsAllowedHere ( name) => {
327
327
let mut err = struct_span_err ! ( resolver. session,
328
328
span,
329
329
E0414 ,
330
330
"only irrefutable patterns allowed here" ) ;
331
331
err. span_note ( span,
332
332
"there already is a constant in scope sharing the same \
333
333
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
- }
337
334
if let Some ( binding) = resolver. current_module
338
335
. 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) ) ;
342
338
}
343
339
err
344
340
}
@@ -2248,12 +2244,11 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2248
2244
depth : 0 ,
2249
2245
} ) ;
2250
2246
}
2251
- FoundConst ( def , name) => {
2247
+ FoundConst ( _ , name) => {
2252
2248
resolve_error (
2253
2249
self ,
2254
2250
pattern. span ,
2255
- ResolutionError :: OnlyIrrefutablePatternsAllowedHere ( def. def_id ( ) ,
2256
- name)
2251
+ ResolutionError :: OnlyIrrefutablePatternsAllowedHere ( name)
2257
2252
) ;
2258
2253
self . record_def ( pattern. id , err_path_resolution ( ) ) ;
2259
2254
}
0 commit comments