diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index 38bbbb1db1b..dcab0858a75 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -532,6 +532,7 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> { }), ) if followed_by_brace => { if let Some(sp) = closing_brace { + err.span_label(span, fallback_label); err.multipart_suggestion( "surround the struct literal with parentheses", vec![ @@ -595,12 +596,15 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> { applicability, ); } - _ => {} + _ => { + err.span_label(span, fallback_label); + } } }; match (res, source) { (Res::Def(DefKind::Macro(MacroKind::Bang), _), _) => { + err.span_label(span, fallback_label); err.span_suggestion_verbose( span.shrink_to_hi(), "use `!` to invoke the macro", diff --git a/src/test/ui/error-codes/E0423.stderr b/src/test/ui/error-codes/E0423.stderr index e43b3c3546b..a9aecb520b2 100644 --- a/src/test/ui/error-codes/E0423.stderr +++ b/src/test/ui/error-codes/E0423.stderr @@ -51,7 +51,7 @@ error[E0423]: expected value, found struct `T` --> $DIR/E0423.rs:14:8 | LL | if T {} == T {} { println!("Ok"); } - | ^ + | ^ not a value | help: surround the struct literal with parentheses | diff --git a/src/test/ui/hygiene/rustc-macro-transparency.stderr b/src/test/ui/hygiene/rustc-macro-transparency.stderr index 024ce820760..94256b2eb79 100644 --- a/src/test/ui/hygiene/rustc-macro-transparency.stderr +++ b/src/test/ui/hygiene/rustc-macro-transparency.stderr @@ -8,7 +8,7 @@ error[E0423]: expected value, found macro `semitransparent` --> $DIR/rustc-macro-transparency.rs:29:5 | LL | semitransparent; - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ not a value | help: use `!` to invoke the macro | @@ -19,7 +19,7 @@ error[E0423]: expected value, found macro `opaque` --> $DIR/rustc-macro-transparency.rs:30:5 | LL | opaque; - | ^^^^^^ + | ^^^^^^ not a value | help: use `!` to invoke the macro | diff --git a/src/test/ui/resolve/resolve-hint-macro.stderr b/src/test/ui/resolve/resolve-hint-macro.stderr index 361da4cc78e..7d35ce7e65e 100644 --- a/src/test/ui/resolve/resolve-hint-macro.stderr +++ b/src/test/ui/resolve/resolve-hint-macro.stderr @@ -2,7 +2,7 @@ error[E0423]: expected function, found macro `assert` --> $DIR/resolve-hint-macro.rs:2:5 | LL | assert(true); - | ^^^^^^ + | ^^^^^^ not a function | help: use `!` to invoke the macro | diff --git a/src/test/ui/struct-literal-variant-in-if.stderr b/src/test/ui/struct-literal-variant-in-if.stderr index 4cd1169cc1b..a2252d4e4d2 100644 --- a/src/test/ui/struct-literal-variant-in-if.stderr +++ b/src/test/ui/struct-literal-variant-in-if.stderr @@ -46,7 +46,7 @@ error[E0423]: expected value, found struct variant `E::V` --> $DIR/struct-literal-variant-in-if.rs:10:13 | LL | if x == E::V { field } {} - | ^^^^ + | ^^^^ not a value | help: surround the struct literal with parentheses | diff --git a/src/test/ui/try-block/try-block-in-edition2015.stderr b/src/test/ui/try-block/try-block-in-edition2015.stderr index fe870ab737c..78cdfb2cc7f 100644 --- a/src/test/ui/try-block/try-block-in-edition2015.stderr +++ b/src/test/ui/try-block/try-block-in-edition2015.stderr @@ -11,7 +11,7 @@ error[E0574]: expected struct, variant or union type, found macro `try` --> $DIR/try-block-in-edition2015.rs:4:33 | LL | let try_result: Option<_> = try { - | ^^^ + | ^^^ not a struct, variant or union type | = note: if you want the `try` keyword, you need to be in the 2018 edition help: use `!` to invoke the macro