Skip to content

Commit 54f1b43

Browse files
committed
Add missing primary label
1 parent 6c0755a commit 54f1b43

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

src/librustc_resolve/late/diagnostics.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> {
532532
}),
533533
) if followed_by_brace => {
534534
if let Some(sp) = closing_brace {
535+
err.span_label(span, fallback_label);
535536
err.multipart_suggestion(
536537
"surround the struct literal with parentheses",
537538
vec![
@@ -595,12 +596,15 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> {
595596
applicability,
596597
);
597598
}
598-
_ => {}
599+
_ => {
600+
err.span_label(span, fallback_label);
601+
}
599602
}
600603
};
601604

602605
match (res, source) {
603606
(Res::Def(DefKind::Macro(MacroKind::Bang), _), _) => {
607+
err.span_label(span, fallback_label);
604608
err.span_suggestion_verbose(
605609
span.shrink_to_hi(),
606610
"use `!` to invoke the macro",

src/test/ui/error-codes/E0423.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ error[E0423]: expected value, found struct `T`
5151
--> $DIR/E0423.rs:14:8
5252
|
5353
LL | if T {} == T {} { println!("Ok"); }
54-
| ^
54+
| ^ not a value
5555
|
5656
help: surround the struct literal with parentheses
5757
|

src/test/ui/hygiene/rustc-macro-transparency.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ error[E0423]: expected value, found macro `semitransparent`
88
--> $DIR/rustc-macro-transparency.rs:29:5
99
|
1010
LL | semitransparent;
11-
| ^^^^^^^^^^^^^^^
11+
| ^^^^^^^^^^^^^^^ not a value
1212
|
1313
help: use `!` to invoke the macro
1414
|
@@ -19,7 +19,7 @@ error[E0423]: expected value, found macro `opaque`
1919
--> $DIR/rustc-macro-transparency.rs:30:5
2020
|
2121
LL | opaque;
22-
| ^^^^^^
22+
| ^^^^^^ not a value
2323
|
2424
help: use `!` to invoke the macro
2525
|

src/test/ui/resolve/resolve-hint-macro.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0423]: expected function, found macro `assert`
22
--> $DIR/resolve-hint-macro.rs:2:5
33
|
44
LL | assert(true);
5-
| ^^^^^^
5+
| ^^^^^^ not a function
66
|
77
help: use `!` to invoke the macro
88
|

src/test/ui/struct-literal-variant-in-if.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ error[E0423]: expected value, found struct variant `E::V`
4646
--> $DIR/struct-literal-variant-in-if.rs:10:13
4747
|
4848
LL | if x == E::V { field } {}
49-
| ^^^^
49+
| ^^^^ not a value
5050
|
5151
help: surround the struct literal with parentheses
5252
|

src/test/ui/try-block/try-block-in-edition2015.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ error[E0574]: expected struct, variant or union type, found macro `try`
1111
--> $DIR/try-block-in-edition2015.rs:4:33
1212
|
1313
LL | let try_result: Option<_> = try {
14-
| ^^^
14+
| ^^^ not a struct, variant or union type
1515
|
1616
= note: if you want the `try` keyword, you need to be in the 2018 edition
1717
help: use `!` to invoke the macro

0 commit comments

Comments
 (0)