about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/generator/unresolved_type_param.rs14
-rw-r--r--src/test/ui/generator/unresolved_type_param.stderr16
2 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/generator/unresolved_type_param.rs b/src/test/ui/generator/unresolved_type_param.rs
new file mode 100644
index 00000000000..f49369b125f
--- /dev/null
+++ b/src/test/ui/generator/unresolved_type_param.rs
@@ -0,0 +1,14 @@
+// Provoke an unresolved type error (T).
+// Error message should pinpoint the type parameter T as needing to be bound
+// (rather than give a general error message)
+// edition:2018
+#![feature(futures_api, async_await, await_macro)]
+async fn bar<T>() -> () {}
+
+async fn foo() {
+        await!(bar());
+        //~^ ERROR type inside generator must be known in this context
+        //~| NOTE cannot infer type for `T`
+        //~| NOTE the type is part of the generator because of this `yield`
+}
+fn main() {}
diff --git a/src/test/ui/generator/unresolved_type_param.stderr b/src/test/ui/generator/unresolved_type_param.stderr
new file mode 100644
index 00000000000..57ccdda3f43
--- /dev/null
+++ b/src/test/ui/generator/unresolved_type_param.stderr
@@ -0,0 +1,16 @@
+error[E0698]: type inside generator must be known in this context
+  --> $DIR/unresolved_type_param.rs:9:16
+   |
+LL |         await!(bar());
+   |                ^^^ cannot infer type for `T`
+   |
+note: the type is part of the generator because of this `yield`
+  --> $DIR/unresolved_type_param.rs:9:9
+   |
+LL |         await!(bar());
+   |         ^^^^^^^^^^^^^^
+   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0698`.