Add missing primary label

This commit is contained in:
Esteban Küber 2020-08-09 21:24:05 -07:00
parent 6c0755a7dc
commit 54f1b43130
6 changed files with 11 additions and 7 deletions

View File

@ -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",

View File

@ -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
|

View File

@ -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
|

View File

@ -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
|

View File

@ -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
|

View File

@ -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