Skip to content

Commit 17dd37d

Browse files
committed
---
yaml --- r: 277899 b: refs/heads/auto c: 5a4e0b1 h: refs/heads/master i: 277897: 231c9fb 277895: 71821f3
1 parent a139f84 commit 17dd37d

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 60c8f7dbf5788f1c9f3a27be2e7be28ecf7817ff
11+
refs/heads/auto: 5a4e0b14e39989f327f9f8103cf38ec43cd22131
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/librustc_resolve/lib.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

branches/auto/src/test/compile-fail/const-pattern-irrefutable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111
mod foo {
12-
pub const b: u8 = 2; //~ NOTE constant defined here
13-
pub const d: u8 = 2; //~ NOTE constant defined here
12+
pub const b: u8 = 2;
13+
pub const d: u8 = 2;
1414
}
1515

1616
use foo::b as c; //~ NOTE constant imported here

0 commit comments

Comments
 (0)