about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-11-19 16:26:21 +0100
committerGitHub <noreply@github.com>2020-11-19 16:26:21 +0100
commit3f0f224be48941f489bcb4b8bcd869d687c168af (patch)
treedb54b84fd9cdbf7b744b42cb49569459ef981557 /src/test/ui
parent5a58b5069873564e37acb42dc2f963b726a769e5 (diff)
parentb8ed466b240887c871909f5e30ea3662a356d19a (diff)
downloadrust-3f0f224be48941f489bcb4b8bcd869d687c168af.tar.gz
rust-3f0f224be48941f489bcb4b8bcd869d687c168af.zip
Rollup merge of #79082 - ThePuzzlemaker:issue-78941-fix, r=estebank
Improve the diagnostic for when an `fn` contains qualifiers inside an `extern` block.

This mitigates #78941. As suggested by ```@estebank,``` `span_suggestion` was replaced with `span_suggestion_verbose` for this specific diagnostic.
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/parser/fn-header-semantic-fail.stderr45
-rw-r--r--src/test/ui/parser/no-const-fn-in-extern-block.stderr18
2 files changed, 42 insertions, 21 deletions
diff --git a/src/test/ui/parser/fn-header-semantic-fail.stderr b/src/test/ui/parser/fn-header-semantic-fail.stderr
index 4193b3ee695..2f11f95bf4a 100644
--- a/src/test/ui/parser/fn-header-semantic-fail.stderr
+++ b/src/test/ui/parser/fn-header-semantic-fail.stderr
@@ -108,9 +108,12 @@ error: functions in `extern` blocks cannot have qualifiers
 LL |     extern {
    |     ------ in this `extern` block
 LL |         async fn fe1();
-   |         ---------^^^
-   |         |
-   |         help: remove the qualifiers: `fn`
+   |                  ^^^
+   |
+help: remove the qualifiers
+   |
+LL |         fn fe1();
+   |         ^^
 
 error: functions in `extern` blocks cannot have qualifiers
   --> $DIR/fn-header-semantic-fail.rs:52:19
@@ -119,9 +122,12 @@ LL |     extern {
    |     ------ in this `extern` block
 LL |         async fn fe1();
 LL |         unsafe fn fe2();
-   |         ----------^^^
-   |         |
-   |         help: remove the qualifiers: `fn`
+   |                   ^^^
+   |
+help: remove the qualifiers
+   |
+LL |         fn fe2();
+   |         ^^
 
 error: functions in `extern` blocks cannot have qualifiers
   --> $DIR/fn-header-semantic-fail.rs:53:18
@@ -130,9 +136,12 @@ LL |     extern {
    |     ------ in this `extern` block
 ...
 LL |         const fn fe3();
-   |         ---------^^^
-   |         |
-   |         help: remove the qualifiers: `fn`
+   |                  ^^^
+   |
+help: remove the qualifiers
+   |
+LL |         fn fe3();
+   |         ^^
 
 error: functions in `extern` blocks cannot have qualifiers
   --> $DIR/fn-header-semantic-fail.rs:54:23
@@ -141,9 +150,12 @@ LL |     extern {
    |     ------ in this `extern` block
 ...
 LL |         extern "C" fn fe4();
-   |         --------------^^^
-   |         |
-   |         help: remove the qualifiers: `fn`
+   |                       ^^^
+   |
+help: remove the qualifiers
+   |
+LL |         fn fe4();
+   |         ^^
 
 error: functions in `extern` blocks cannot have qualifiers
   --> $DIR/fn-header-semantic-fail.rs:55:42
@@ -152,9 +164,12 @@ LL |     extern {
    |     ------ in this `extern` block
 ...
 LL |         const async unsafe extern "C" fn fe5();
-   |         ---------------------------------^^^
-   |         |
-   |         help: remove the qualifiers: `fn`
+   |                                          ^^^
+   |
+help: remove the qualifiers
+   |
+LL |         fn fe5();
+   |         ^^
 
 error: functions cannot be both `const` and `async`
   --> $DIR/fn-header-semantic-fail.rs:55:9
diff --git a/src/test/ui/parser/no-const-fn-in-extern-block.stderr b/src/test/ui/parser/no-const-fn-in-extern-block.stderr
index de653987e40..af92f2d94f2 100644
--- a/src/test/ui/parser/no-const-fn-in-extern-block.stderr
+++ b/src/test/ui/parser/no-const-fn-in-extern-block.stderr
@@ -4,9 +4,12 @@ error: functions in `extern` blocks cannot have qualifiers
 LL | extern {
    | ------ in this `extern` block
 LL |     const fn foo();
-   |     ---------^^^
-   |     |
-   |     help: remove the qualifiers: `fn`
+   |              ^^^
+   |
+help: remove the qualifiers
+   |
+LL |     fn foo();
+   |     ^^
 
 error: functions in `extern` blocks cannot have qualifiers
   --> $DIR/no-const-fn-in-extern-block.rs:4:21
@@ -15,9 +18,12 @@ LL | extern {
    | ------ in this `extern` block
 ...
 LL |     const unsafe fn bar();
-   |     ----------------^^^
-   |     |
-   |     help: remove the qualifiers: `fn`
+   |                     ^^^
+   |
+help: remove the qualifiers
+   |
+LL |     fn bar();
+   |     ^^
 
 error: aborting due to 2 previous errors