From b0806b2de9a737e1b4821a4c163b29dcac088ce8 Mon Sep 17 00:00:00 2001 From: Alexis Bourget Date: Sun, 24 Oct 2021 15:11:11 +0200 Subject: [PATCH] Update test to new error message --- compiler/rustc_parse/src/parser/item.rs | 2 +- src/test/ui/parser/duplicate-visibility.rs | 2 +- src/test/ui/parser/duplicate-visibility.stderr | 2 +- src/test/ui/parser/issue-87694-duplicated-pub.rs | 2 +- .../ui/parser/issue-87694-duplicated-pub.stderr | 2 +- .../const-async-const.rs | 8 +++----- .../const-async-const.stderr | 16 ++++++++++------ 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 6ea86fe9f45..f8b313cd0e9 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -2026,7 +2026,7 @@ impl<'a> Parser<'a> { else { err.span_suggestion( current_vis.span, - "there is already a visibility, remove this one", + "there is already a visibility modifier, remove one", "".to_string(), Applicability::MachineApplicable, ) diff --git a/src/test/ui/parser/duplicate-visibility.rs b/src/test/ui/parser/duplicate-visibility.rs index 3da4dd28b6d..32aeee29472 100644 --- a/src/test/ui/parser/duplicate-visibility.rs +++ b/src/test/ui/parser/duplicate-visibility.rs @@ -4,6 +4,6 @@ extern "C" { //~ NOTE while parsing this item list starting here pub pub fn foo(); //~^ ERROR expected one of `(`, `async`, `const`, `default`, `extern`, `fn`, `pub`, `unsafe`, or `use`, found keyword `pub` //~| 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 the item list ends here diff --git a/src/test/ui/parser/duplicate-visibility.stderr b/src/test/ui/parser/duplicate-visibility.stderr index b289f2d0adc..97144ac2f64 100644 --- a/src/test/ui/parser/duplicate-visibility.stderr +++ b/src/test/ui/parser/duplicate-visibility.stderr @@ -7,7 +7,7 @@ LL | pub pub fn foo(); | ^^^ | | | 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 | } | - the item list ends here diff --git a/src/test/ui/parser/issue-87694-duplicated-pub.rs b/src/test/ui/parser/issue-87694-duplicated-pub.rs index cf6e463d41d..e3ea61dc4ad 100644 --- a/src/test/ui/parser/issue-87694-duplicated-pub.rs +++ b/src/test/ui/parser/issue-87694-duplicated-pub.rs @@ -1,5 +1,5 @@ pub const pub fn test() {} //~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub` //~| 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 diff --git a/src/test/ui/parser/issue-87694-duplicated-pub.stderr b/src/test/ui/parser/issue-87694-duplicated-pub.stderr index 9d62c3feb55..8d242bc9de5 100644 --- a/src/test/ui/parser/issue-87694-duplicated-pub.stderr +++ b/src/test/ui/parser/issue-87694-duplicated-pub.stderr @@ -5,7 +5,7 @@ LL | pub const pub fn test() {} | ^^^ | | | 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 --> $DIR/issue-87694-duplicated-pub.rs:1:1 diff --git a/src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs b/src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs index 7c3d915a4c0..df0cd54399a 100644 --- a/src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs +++ b/src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs @@ -1,11 +1,9 @@ // edition:2018 -// Test that even when `const` is already present, the proposed fix is `const const async`, -// like for `pub pub`. +// Test that even when `const` is already present, the proposed fix is to remove the second `const` const async const fn test() {} //~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `const` //~| NOTE expected one of `extern`, `fn`, or `unsafe` -//~| HELP `const` must come before `async` -//~| SUGGESTION const async -//~| NOTE keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern` +//~| HELP `const` already used earlier, remove this one +//~| NOTE `const` first seen here diff --git a/src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr b/src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr index 56280912540..977c6ebfef3 100644 --- a/src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr +++ b/src/test/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr @@ -1,13 +1,17 @@ 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() {} - | ------^^^^^ - | | | - | | expected one of `extern`, `fn`, or `unsafe` - | help: `const` must come before `async`: `const async` + | ^^^^^ + | | + | expected one of `extern`, `fn`, or `unsafe` + | 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