test E0133 when calling free/impl async unsafe fn
in safe code
This commit is contained in:
parent
1574c2dee2
commit
0f66ce65db
2 changed files with 35 additions and 0 deletions
16
src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs
Normal file
16
src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// edition:2018
|
||||
|
||||
#![feature(async_await, async_closure)]
|
||||
|
||||
struct S;
|
||||
|
||||
impl S {
|
||||
async unsafe fn f() {}
|
||||
}
|
||||
|
||||
async unsafe fn f() {}
|
||||
|
||||
fn main() {
|
||||
S::f(); //~ ERROR call to unsafe function is unsafe
|
||||
f(); //~ ERROR call to unsafe function is unsafe
|
||||
}
|
19
src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr
Normal file
19
src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr
Normal file
|
@ -0,0 +1,19 @@
|
|||
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: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
Loading…
Add table
Add a link
Reference in a new issue