Update test to new error message

This commit is contained in:
Alexis Bourget 2021-10-24 15:11:11 +02:00
parent 5c9950023b
commit b0806b2de9
7 changed files with 18 additions and 16 deletions

View File

@ -2026,7 +2026,7 @@ impl<'a> Parser<'a> {
else { else {
err.span_suggestion( err.span_suggestion(
current_vis.span, current_vis.span,
"there is already a visibility, remove this one", "there is already a visibility modifier, remove one",
"".to_string(), "".to_string(),
Applicability::MachineApplicable, Applicability::MachineApplicable,
) )

View File

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

View File

@ -7,7 +7,7 @@ LL | pub pub fn foo();
| ^^^ | ^^^
| | | |
| expected one of 9 possible tokens | expected one of 9 possible tokens
| help: there is already a visibility, remove this one | help: there is already a visibility modifier, remove one
... ...
LL | } LL | }
| - the item list ends here | - the item list ends here

View File

@ -1,5 +1,5 @@
pub const pub fn test() {} pub const pub fn test() {}
//~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub` //~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
//~| NOTE expected one of `async`, `extern`, `fn`, or `unsafe` //~| NOTE expected one of `async`, `extern`, `fn`, or `unsafe`
//~| HELP there is already a visibility, remove this one //~| HELP there is already a visibility modifier, remove one
//~| NOTE explicit visibility first seen here //~| NOTE explicit visibility first seen here

View File

@ -5,7 +5,7 @@ LL | pub const pub fn test() {}
| ^^^ | ^^^
| | | |
| expected one of `async`, `extern`, `fn`, or `unsafe` | expected one of `async`, `extern`, `fn`, or `unsafe`
| help: there is already a visibility, remove this one | help: there is already a visibility modifier, remove one
| |
note: explicit visibility first seen here note: explicit visibility first seen here
--> $DIR/issue-87694-duplicated-pub.rs:1:1 --> $DIR/issue-87694-duplicated-pub.rs:1:1

View File

@ -1,11 +1,9 @@
// edition:2018 // edition:2018
// Test that even when `const` is already present, the proposed fix is `const const async`, // Test that even when `const` is already present, the proposed fix is to remove the second `const`
// like for `pub pub`.
const async const fn test() {} const async const fn test() {}
//~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `const` //~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
//~| NOTE expected one of `extern`, `fn`, or `unsafe` //~| NOTE expected one of `extern`, `fn`, or `unsafe`
//~| HELP `const` must come before `async` //~| HELP `const` already used earlier, remove this one
//~| SUGGESTION const async //~| NOTE `const` first seen here
//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern`

View File

@ -1,13 +1,17 @@
error: expected one of `extern`, `fn`, or `unsafe`, found keyword `const` error: expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
--> $DIR/const-async-const.rs:6:13 --> $DIR/const-async-const.rs:5:13
| |
LL | const async const fn test() {} LL | const async const fn test() {}
| ------^^^^^ | ^^^^^
| | | | |
| | expected one of `extern`, `fn`, or `unsafe` | expected one of `extern`, `fn`, or `unsafe`
| help: `const` must come before `async`: `const async` | help: `const` already used earlier, remove this one
| |
= note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern` note: `const` first seen here
--> $DIR/const-async-const.rs:5:1
|
LL | const async const fn test() {}
| ^^^^^
error: aborting due to previous error error: aborting due to previous error