From 60f480dacbc4ee0dbe5bd7dfa6efe0458ea6aab2 Mon Sep 17 00:00:00 2001 From: Delan Azabani Date: Fri, 12 Jul 2019 14:43:52 +1000 Subject: [PATCH] test E0133 when calling free/impl `async unsafe fn` in `async fn` --- .../async-unsafe-fn-call-in-safe.rs | 5 +++++ .../async-unsafe-fn-call-in-safe.stderr | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs index 25302d94713..cb9156dcc6e 100644 --- a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs +++ b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs @@ -10,6 +10,11 @@ impl S { 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 diff --git a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr index 21ba45d7f1e..d22413beecb 100644 --- a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr +++ b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr @@ -14,6 +14,22 @@ LL | f(); | = note: consult the function's documentation for information on how to avoid undefined behavior -error: aborting due to 2 previous errors +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`.