diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 6bf4da438dd..24eb9a0808c 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -392,11 +392,13 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>, err } ResolutionError::UndeclaredLabel(name) => { - struct_span_err!(resolver.session, - span, - E0426, - "use of undeclared label `{}`", - name) + let mut err = struct_span_err!(resolver.session, + span, + E0426, + "use of undeclared label `{}`", + name); + err.span_label(span, &format!("undeclared label `{}`",&name)); + err } ResolutionError::SelfImportsOnlyAllowedWithin => { struct_span_err!(resolver.session, diff --git a/src/test/compile-fail/E0426.rs b/src/test/compile-fail/E0426.rs index 2eb4c2d3b5e..be21421cb07 100644 --- a/src/test/compile-fail/E0426.rs +++ b/src/test/compile-fail/E0426.rs @@ -10,6 +10,8 @@ fn main () { loop { - break 'a; //~ ERROR E0426 + break 'a; + //~^ ERROR E0426 + //~| NOTE undeclared label `'a` } }