Skip to content

Commit b0806b2

Browse files
committed
Update test to new error message
1 parent 5c99500 commit b0806b2

File tree

7 files changed

+18
-16
lines changed

7 files changed

+18
-16
lines changed

compiler/rustc_parse/src/parser/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,7 @@ impl<'a> Parser<'a> {
20262026
else {
20272027
err.span_suggestion(
20282028
current_vis.span,
2029-
"there is already a visibility, remove this one",
2029+
"there is already a visibility modifier, remove one",
20302030
"".to_string(),
20312031
Applicability::MachineApplicable,
20322032
)

src/test/ui/parser/duplicate-visibility.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ extern "C" { //~ NOTE while parsing this item list starting here
44
pub pub fn foo();
55
//~^ ERROR expected one of `(`, `async`, `const`, `default`, `extern`, `fn`, `pub`, `unsafe`, or `use`, found keyword `pub`
66
//~| NOTE expected one of 9 possible tokens
7-
//~| HELP there is already a visibility, remove this one
7+
//~| HELP there is already a visibility modifier, remove one
88
//~| NOTE explicit visibility first seen here
99
} //~ NOTE the item list ends here

src/test/ui/parser/duplicate-visibility.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | pub pub fn foo();
77
| ^^^
88
| |
99
| expected one of 9 possible tokens
10-
| help: there is already a visibility, remove this one
10+
| help: there is already a visibility modifier, remove one
1111
...
1212
LL | }
1313
| - the item list ends here
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub const pub fn test() {}
22
//~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
33
//~| NOTE expected one of `async`, `extern`, `fn`, or `unsafe`
4-
//~| HELP there is already a visibility, remove this one
4+
//~| HELP there is already a visibility modifier, remove one
55
//~| NOTE explicit visibility first seen here

src/test/ui/parser/issue-87694-duplicated-pub.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | pub const pub fn test() {}
55
| ^^^
66
| |
77
| expected one of `async`, `extern`, `fn`, or `unsafe`
8-
| help: there is already a visibility, remove this one
8+
| help: there is already a visibility modifier, remove one
99
|
1010
note: explicit visibility first seen here
1111
--> $DIR/issue-87694-duplicated-pub.rs:1:1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
// edition:2018
22

3-
// Test that even when `const` is already present, the proposed fix is `const const async`,
4-
// like for `pub pub`.
3+
// Test that even when `const` is already present, the proposed fix is to remove the second `const`
54

65
const async const fn test() {}
76
//~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
87
//~| NOTE expected one of `extern`, `fn`, or `unsafe`
9-
//~| HELP `const` must come before `async`
10-
//~| SUGGESTION const async
11-
//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
8+
//~| HELP `const` already used earlier, remove this one
9+
//~| NOTE `const` first seen here
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
error: expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
2-
--> $DIR/const-async-const.rs:6:13
2+
--> $DIR/const-async-const.rs:5:13
33
|
44
LL | const async const fn test() {}
5-
| ------^^^^^
6-
| | |
7-
| | expected one of `extern`, `fn`, or `unsafe`
8-
| help: `const` must come before `async`: `const async`
5+
| ^^^^^
6+
| |
7+
| expected one of `extern`, `fn`, or `unsafe`
8+
| help: `const` already used earlier, remove this one
99
|
10-
= note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`
10+
note: `const` first seen here
11+
--> $DIR/const-async-const.rs:5:1
12+
|
13+
LL | const async const fn test() {}
14+
| ^^^^^
1115

1216
error: aborting due to previous error
1317

0 commit comments

Comments
 (0)