forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#62608 - delan:async-unsafe-fn-tests, r=Centril
`async unsafe fn` tests - cc rust-lang#62121 r? @Centril
- Loading branch information
Showing
5 changed files
with
118 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// edition:2018 | ||
|
||
#![feature(async_await)] | ||
|
||
struct S; | ||
|
||
impl S { | ||
async unsafe fn f() {} | ||
} | ||
|
||
async unsafe fn f() {} | ||
|
||
async fn g() { | ||
S::f(); //~ ERROR call to unsafe function is unsafe | ||
f(); //~ ERROR call to unsafe function is unsafe | ||
} | ||
|
||
fn main() { | ||
S::f(); //~ ERROR call to unsafe function is unsafe | ||
f(); //~ ERROR call to unsafe function is unsafe | ||
} |
35 changes: 35 additions & 0 deletions
35
src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr
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,35 @@ | ||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block | ||
--> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 | ||
| | ||
LL | S::f(); | ||
| ^^^^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block | ||
--> $DIR/async-unsafe-fn-call-in-safe.rs:15:5 | ||
| | ||
LL | f(); | ||
| ^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block | ||
--> $DIR/async-unsafe-fn-call-in-safe.rs:19:5 | ||
| | ||
LL | S::f(); | ||
| ^^^^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block | ||
--> $DIR/async-unsafe-fn-call-in-safe.rs:20:5 | ||
| | ||
LL | f(); | ||
| ^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0133`. |
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