diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 9f1f07004f4ae..3a58f2f803956 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -412,7 +412,9 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>, struct_span_err!(resolver.session, span, E0432, "{}", msg) } ResolutionError::FailedToResolve(msg) => { - struct_span_err!(resolver.session, span, E0433, "failed to resolve. {}", msg) + let mut err = struct_span_err!(resolver.session, span, E0433, "failed to resolve. {}", msg); + err.span_label(span, &msg); + err } ResolutionError::CannotCaptureDynamicEnvironmentInFnItem => { struct_span_err!(resolver.session, diff --git a/src/test/compile-fail/derived-errors/issue-31997-1.rs b/src/test/compile-fail/derived-errors/issue-31997-1.rs index 7d79c48c06ae2..6a9d8db9654ac 100644 --- a/src/test/compile-fail/derived-errors/issue-31997-1.rs +++ b/src/test/compile-fail/derived-errors/issue-31997-1.rs @@ -29,6 +29,7 @@ fn main() { let mut map = HashMap::new(); //~^ ERROR E0433 + //~| NOTE Use of undeclared type or module `HashMap` for line in input.lines() { let line = line.unwrap();