-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #76447 - pickfire:async-pub, r=estebank
Detect async visibility wrong order, `async pub` Partially address #76437.
- Loading branch information
Showing
16 changed files
with
160 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
// ignore-tidy-linelength | ||
|
||
fn main() {} | ||
|
||
extern "C" { | ||
pub pub fn foo(); | ||
//~^ ERROR visibility `pub` is not followed by an item | ||
//~| ERROR non-item in item list | ||
//~^ ERROR expected one of `(`, `async`, `const`, `default`, `extern`, `fn`, `pub`, `unsafe`, or `use`, found keyword `pub` | ||
} |
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,21 +1,16 @@ | ||
error: visibility `pub` is not followed by an item | ||
--> $DIR/duplicate-visibility.rs:4:5 | ||
| | ||
LL | pub pub fn foo(); | ||
| ^^^ the visibility | ||
| | ||
= help: you likely meant to define an item, e.g., `pub fn foo() {}` | ||
|
||
error: non-item in item list | ||
--> $DIR/duplicate-visibility.rs:4:9 | ||
error: expected one of `(`, `async`, `const`, `default`, `extern`, `fn`, `pub`, `unsafe`, or `use`, found keyword `pub` | ||
--> $DIR/duplicate-visibility.rs:6:9 | ||
| | ||
LL | extern "C" { | ||
| - item list starts here | ||
| - while parsing this item list starting here | ||
LL | pub pub fn foo(); | ||
| ^^^ non-item starts here | ||
... | ||
| ^^^ | ||
| | | ||
| expected one of 9 possible tokens | ||
| help: visibility `pub` must come before `pub pub`: `pub pub pub` | ||
LL | | ||
LL | } | ||
| - item list ends here | ||
| - the item list ends here | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to previous error | ||
|
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,7 @@ | ||
// edition:2018 | ||
|
||
mod t { | ||
async pub fn t() {} | ||
//~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `pub` | ||
//~| HELP visibility `pub` must come before `async` | ||
} |
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,11 @@ | ||
error: expected one of `extern`, `fn`, or `unsafe`, found keyword `pub` | ||
--> $DIR/issue-76437-async.rs:4:11 | ||
| | ||
LL | async pub fn t() {} | ||
| ------^^^ | ||
| | | | ||
| | expected one of `extern`, `fn`, or `unsafe` | ||
| help: visibility `pub` must come before `async`: `pub async` | ||
|
||
error: aborting due to previous error | ||
|
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,7 @@ | ||
// edition:2018 | ||
|
||
mod t { | ||
const async unsafe pub fn t() {} | ||
//~^ ERROR expected one of `extern` or `fn`, found keyword `pub` | ||
//~| HELP visibility `pub` must come before `const async unsafe` | ||
} |
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,11 @@ | ||
error: expected one of `extern` or `fn`, found keyword `pub` | ||
--> $DIR/issue-76437-const-async-unsafe.rs:4:24 | ||
| | ||
LL | const async unsafe pub fn t() {} | ||
| -------------------^^^ | ||
| | | | ||
| | expected one of `extern` or `fn` | ||
| help: visibility `pub` must come before `const async unsafe`: `pub const async unsafe` | ||
|
||
error: aborting due to previous error | ||
|
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,7 @@ | ||
// edition:2018 | ||
|
||
mod t { | ||
const async pub fn t() {} | ||
//~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `pub` | ||
//~| HELP visibility `pub` must come before `const async` | ||
} |
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,11 @@ | ||
error: expected one of `extern`, `fn`, or `unsafe`, found keyword `pub` | ||
--> $DIR/issue-76437-const-async.rs:4:17 | ||
| | ||
LL | const async pub fn t() {} | ||
| ------------^^^ | ||
| | | | ||
| | expected one of `extern`, `fn`, or `unsafe` | ||
| help: visibility `pub` must come before `const async`: `pub const async` | ||
|
||
error: aborting due to previous error | ||
|
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,7 @@ | ||
// edition:2018 | ||
|
||
mod t { | ||
const pub fn t() {} | ||
//~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub` | ||
//~| HELP visibility `pub` must come before `const` | ||
} |
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,11 @@ | ||
error: expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub` | ||
--> $DIR/issue-76437-const.rs:4:11 | ||
| | ||
LL | const pub fn t() {} | ||
| ------^^^ | ||
| | | | ||
| | expected one of `async`, `extern`, `fn`, or `unsafe` | ||
| help: visibility `pub` must come before `const`: `pub const` | ||
|
||
error: aborting due to previous error | ||
|
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,7 @@ | ||
// edition:2018 | ||
|
||
mod t { | ||
unsafe pub(crate) fn t() {} | ||
//~^ ERROR expected one of `extern` or `fn`, found keyword `pub` | ||
//~| HELP visibility `pub(crate)` must come before `unsafe` | ||
} |
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,11 @@ | ||
error: expected one of `extern` or `fn`, found keyword `pub` | ||
--> $DIR/issue-76437-pub-crate-unsafe.rs:4:12 | ||
| | ||
LL | unsafe pub(crate) fn t() {} | ||
| -------^^^------- | ||
| | | | ||
| | expected one of `extern` or `fn` | ||
| help: visibility `pub(crate)` must come before `unsafe`: `pub(crate) unsafe` | ||
|
||
error: aborting due to previous error | ||
|
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,7 @@ | ||
// edition:2018 | ||
|
||
mod t { | ||
unsafe pub fn t() {} | ||
//~^ ERROR expected one of `extern` or `fn`, found keyword `pub` | ||
//~| HELP visibility `pub` must come before `unsafe` | ||
} |
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,11 @@ | ||
error: expected one of `extern` or `fn`, found keyword `pub` | ||
--> $DIR/issue-76437-unsafe.rs:4:12 | ||
| | ||
LL | unsafe pub fn t() {} | ||
| -------^^^ | ||
| | | | ||
| | expected one of `extern` or `fn` | ||
| help: visibility `pub` must come before `unsafe`: `pub unsafe` | ||
|
||
error: aborting due to previous error | ||
|