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.
This commit is contained in:
Dylan DPC 2020-11-19 16:26:21 +01:00 committed by GitHub
commit 3f0f224be4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 22 deletions

View file

@ -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

View file

@ -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