about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/async-await/async-fn/edition-2015-not-async-bound.rs10
-rw-r--r--tests/ui/async-await/async-fn/edition-2015.rs11
-rw-r--r--tests/ui/async-await/async-fn/edition-2015.stderr51
3 files changed, 51 insertions, 21 deletions
diff --git a/tests/ui/async-await/async-fn/edition-2015-not-async-bound.rs b/tests/ui/async-await/async-fn/edition-2015-not-async-bound.rs
new file mode 100644
index 00000000000..6436787b665
--- /dev/null
+++ b/tests/ui/async-await/async-fn/edition-2015-not-async-bound.rs
@@ -0,0 +1,10 @@
+// check-pass
+// Make sure that we don't eagerly recover `async ::Bound` in edition 2015.
+
+mod async {
+    pub trait Foo {}
+}
+
+fn test(x: impl async ::Foo) {}
+
+fn main() {}
diff --git a/tests/ui/async-await/async-fn/edition-2015.rs b/tests/ui/async-await/async-fn/edition-2015.rs
index 287d05ecacb..83b9d415dda 100644
--- a/tests/ui/async-await/async-fn/edition-2015.rs
+++ b/tests/ui/async-await/async-fn/edition-2015.rs
@@ -1,8 +1,7 @@
-// FIXME(async_closures): This error message could be made better.
-
-fn foo(x: impl async Fn()) -> impl async Fn() {}
-//~^ ERROR expected
-//~| ERROR expected
-//~| ERROR expected
+fn foo(x: impl async Fn()) -> impl async Fn() { x }
+//~^ ERROR `async` trait bounds are only allowed in Rust 2018 or later
+//~| ERROR `async` trait bounds are only allowed in Rust 2018 or later
+//~| ERROR async closures are unstable
+//~| ERROR async closures are unstable
 
 fn main() {}
diff --git a/tests/ui/async-await/async-fn/edition-2015.stderr b/tests/ui/async-await/async-fn/edition-2015.stderr
index e79b92ccf9f..0029d53868d 100644
--- a/tests/ui/async-await/async-fn/edition-2015.stderr
+++ b/tests/ui/async-await/async-fn/edition-2015.stderr
@@ -1,22 +1,43 @@
-error: expected one of `:` or `|`, found `)`
-  --> $DIR/edition-2015.rs:3:26
+error: `async` trait bounds are only allowed in Rust 2018 or later
+  --> $DIR/edition-2015.rs:1:16
    |
-LL | fn foo(x: impl async Fn()) -> impl async Fn() {}
-   |                          ^ expected one of `:` or `|`
+LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
+   |                ^^^^^
+   |
+   = help: pass `--edition 2021` to `rustc`
+   = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error: `async` trait bounds are only allowed in Rust 2018 or later
+  --> $DIR/edition-2015.rs:1:36
+   |
+LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
+   |                                    ^^^^^
+   |
+   = help: pass `--edition 2021` to `rustc`
+   = note: for more on editions, read https://doc.rust-lang.org/edition-guide
 
-error: expected one of `(`, `)`, `+`, `,`, `::`, or `<`, found `Fn`
-  --> $DIR/edition-2015.rs:3:22
+error[E0658]: async closures are unstable
+  --> $DIR/edition-2015.rs:1:16
+   |
+LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
+   |                ^^^^^
    |
-LL | fn foo(x: impl async Fn()) -> impl async Fn() {}
-   |                     -^^ expected one of `(`, `)`, `+`, `,`, `::`, or `<`
-   |                     |
-   |                     help: missing `,`
+   = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
+   = help: add `#![feature(async_closure)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+   = help: to use an async block, remove the `||`: `async {`
 
-error: expected one of `(`, `+`, `::`, `<`, `where`, or `{`, found `Fn`
-  --> $DIR/edition-2015.rs:3:42
+error[E0658]: async closures are unstable
+  --> $DIR/edition-2015.rs:1:36
+   |
+LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
+   |                                    ^^^^^
    |
-LL | fn foo(x: impl async Fn()) -> impl async Fn() {}
-   |                                          ^^ expected one of `(`, `+`, `::`, `<`, `where`, or `{`
+   = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
+   = help: add `#![feature(async_closure)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+   = help: to use an async block, remove the `||`: `async {`
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
 
+For more information about this error, try `rustc --explain E0658`.