about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-12-14 18:24:21 +0000
committerMichael Goulet <michael@errs.io>2022-12-14 18:25:12 +0000
commitbcaf210575f8b8ca4ea7fd37ef2ef40e7c263ad9 (patch)
tree3ccaeb76c15cdf95fa68fb51023ca44f46e35710 /src
parentba64ba8b0dfd57f7d6d7399d0df7ded37d2af18d (diff)
downloadrust-bcaf210575f8b8ca4ea7fd37ef2ef40e7c263ad9.tar.gz
rust-bcaf210575f8b8ca4ea7fd37ef2ef40e7c263ad9.zip
bail in collect_trait_impl_trait_tys if signatures reference errors
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/async-await/in-trait/bad-signatures.rs16
-rw-r--r--src/test/ui/async-await/in-trait/bad-signatures.stderr26
2 files changed, 42 insertions, 0 deletions
diff --git a/src/test/ui/async-await/in-trait/bad-signatures.rs b/src/test/ui/async-await/in-trait/bad-signatures.rs
new file mode 100644
index 00000000000..b86f1d1c135
--- /dev/null
+++ b/src/test/ui/async-await/in-trait/bad-signatures.rs
@@ -0,0 +1,16 @@
+// edition:2021
+
+#![feature(async_fn_in_trait)]
+//~^ WARN the feature `async_fn_in_trait` is incomplete
+
+trait MyTrait {
+    async fn bar(&abc self);
+    //~^ ERROR expected identifier, found keyword `self`
+    //~| ERROR expected one of `:`, `@`, or `|`, found keyword `self`
+}
+
+impl MyTrait for () {
+    async fn bar(&self) {}
+}
+
+fn main() {}
diff --git a/src/test/ui/async-await/in-trait/bad-signatures.stderr b/src/test/ui/async-await/in-trait/bad-signatures.stderr
new file mode 100644
index 00000000000..e0ba7b53ec4
--- /dev/null
+++ b/src/test/ui/async-await/in-trait/bad-signatures.stderr
@@ -0,0 +1,26 @@
+error: expected identifier, found keyword `self`
+  --> $DIR/bad-signatures.rs:7:23
+   |
+LL |     async fn bar(&abc self);
+   |                       ^^^^ expected identifier, found keyword
+
+error: expected one of `:`, `@`, or `|`, found keyword `self`
+  --> $DIR/bad-signatures.rs:7:23
+   |
+LL |     async fn bar(&abc self);
+   |                  -----^^^^
+   |                  |    |
+   |                  |    expected one of `:`, `@`, or `|`
+   |                  help: declare the type after the parameter binding: `<identifier>: <type>`
+
+warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/bad-signatures.rs:3:12
+   |
+LL | #![feature(async_fn_in_trait)]
+   |            ^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+   = note: `#[warn(incomplete_features)]` on by default
+
+error: aborting due to 2 previous errors; 1 warning emitted
+