about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDelan Azabani <delan@azabani.com>2019-07-12 14:43:52 +1000
committerDelan Azabani <delan@azabani.com>2019-07-12 14:44:50 +1000
commit60f480dacbc4ee0dbe5bd7dfa6efe0458ea6aab2 (patch)
tree80375a77c1e737e157e858501bdca96c19047632
parente65c1c44a2775f95fcd120bc1b9ac2f04c61890d (diff)
downloadrust-60f480dacbc4ee0dbe5bd7dfa6efe0458ea6aab2.tar.gz
rust-60f480dacbc4ee0dbe5bd7dfa6efe0458ea6aab2.zip
test E0133 when calling free/impl `async unsafe fn` in `async fn`
-rw-r--r--src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs5
-rw-r--r--src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr18
2 files changed, 22 insertions, 1 deletions
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`.