forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix diagnostic for qualifier in extern block
Closes: rust-lang#123306
- Loading branch information
Showing
8 changed files
with
136 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//@ edition:2018 | ||
|
||
extern "C" { | ||
const fn a(); | ||
//~^ ERROR functions in `extern` blocks cannot have qualifiers | ||
|
||
unsafe fn b(); | ||
//~^ ERROR functions in `extern` blocks cannot have qualifiers | ||
|
||
async fn c(); | ||
//~^ ERROR functions in `extern` blocks cannot have qualifiers | ||
|
||
extern fn d(); | ||
//~^ ERROR functions in `extern` blocks cannot have qualifiers | ||
|
||
extern "C" fn e(); | ||
//~^ ERROR functions in `extern` blocks cannot have qualifiers | ||
} | ||
|
||
pub fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
error: functions in `extern` blocks cannot have qualifiers | ||
--> $DIR/extern-headerless.rs:4:5 | ||
| | ||
LL | extern "C" { | ||
| ---------- in this `extern` block | ||
LL | const fn a(); | ||
| ^^^^^ help: remove this qualifier | ||
|
||
error: functions in `extern` blocks cannot have qualifiers | ||
--> $DIR/extern-headerless.rs:7:5 | ||
| | ||
LL | extern "C" { | ||
| ---------- in this `extern` block | ||
... | ||
LL | unsafe fn b(); | ||
| ^^^^^^ help: remove this qualifier | ||
|
||
error: functions in `extern` blocks cannot have qualifiers | ||
--> $DIR/extern-headerless.rs:10:5 | ||
| | ||
LL | extern "C" { | ||
| ---------- in this `extern` block | ||
... | ||
LL | async fn c(); | ||
| ^^^^^ help: remove this qualifier | ||
|
||
error: functions in `extern` blocks cannot have qualifiers | ||
--> $DIR/extern-headerless.rs:13:5 | ||
| | ||
LL | extern "C" { | ||
| ---------- in this `extern` block | ||
... | ||
LL | extern fn d(); | ||
| ^^^^^^ help: remove this qualifier | ||
|
||
error: functions in `extern` blocks cannot have qualifiers | ||
--> $DIR/extern-headerless.rs:16:5 | ||
| | ||
LL | extern "C" { | ||
| ---------- in this `extern` block | ||
... | ||
LL | extern "C" fn e(); | ||
| ^^^^^^^^^^ help: remove this qualifier | ||
|
||
error: aborting due to 5 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,28 @@ | ||
error: functions in `extern` blocks cannot have qualifiers | ||
--> $DIR/no-const-fn-in-extern-block.rs:2:14 | ||
--> $DIR/no-const-fn-in-extern-block.rs:2:5 | ||
| | ||
LL | extern "C" { | ||
| ---------- in this `extern` block | ||
LL | const fn foo(); | ||
| ^^^ | ||
| | ||
help: remove the qualifiers | ||
| | ||
LL | fn foo(); | ||
| ~~ | ||
| ^^^^^ help: remove this qualifier | ||
|
||
error: functions in `extern` blocks cannot have qualifiers | ||
--> $DIR/no-const-fn-in-extern-block.rs:4:21 | ||
--> $DIR/no-const-fn-in-extern-block.rs:4:11 | ||
| | ||
LL | extern "C" { | ||
| ---------- in this `extern` block | ||
... | ||
LL | const unsafe fn bar(); | ||
| ^^^ | ||
| | ||
help: remove the qualifiers | ||
| ^^^^^^ help: remove this qualifier | ||
|
||
error: functions in `extern` blocks cannot have qualifiers | ||
--> $DIR/no-const-fn-in-extern-block.rs:4:5 | ||
| | ||
LL | fn bar(); | ||
| ~~ | ||
LL | extern "C" { | ||
| ---------- in this `extern` block | ||
... | ||
LL | const unsafe fn bar(); | ||
| ^^^^^ help: remove this qualifier | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to 3 previous errors | ||
|