about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-05-18 14:08:56 +0200
committerGitHub <noreply@github.com>2021-05-18 14:08:56 +0200
commit5f544bcf70c867f46f6e4766bf7c38cd7f5736f8 (patch)
tree68294159d8c28e9e439e89a99b0e1147552ccfbc /src/test
parentfad04ff60e36e5638b23f5fb5ce3c4598603119f (diff)
parent500503b16ca9f72a44028e27c1cc2fa76be49085 (diff)
downloadrust-5f544bcf70c867f46f6e4766bf7c38cd7f5736f8.tar.gz
rust-5f544bcf70c867f46f6e4766bf7c38cd7f5736f8.zip
Rollup merge of #85393 - Aaron1011:async-type-err, r=varkor
Suppress spurious errors inside `async fn`

Fixes #73741
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/async-await/issue-73741-type-err.rs14
-rw-r--r--src/test/ui/async-await/issue-73741-type-err.stderr11
2 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/async-await/issue-73741-type-err.rs b/src/test/ui/async-await/issue-73741-type-err.rs
new file mode 100644
index 00000000000..c5b9e34edf7
--- /dev/null
+++ b/src/test/ui/async-await/issue-73741-type-err.rs
@@ -0,0 +1,14 @@
+// edition:2018
+//
+// Regression test for issue #73741
+// Ensures that we don't emit spurious errors when
+// a type error ocurrs in an `async fn`
+
+async fn weird() {
+    1 = 2; //~ ERROR invalid left-hand side
+
+    let mut loop_count = 0;
+    async {}.await
+}
+
+fn main() {}
diff --git a/src/test/ui/async-await/issue-73741-type-err.stderr b/src/test/ui/async-await/issue-73741-type-err.stderr
new file mode 100644
index 00000000000..0b5343a98cf
--- /dev/null
+++ b/src/test/ui/async-await/issue-73741-type-err.stderr
@@ -0,0 +1,11 @@
+error[E0070]: invalid left-hand side of assignment
+  --> $DIR/issue-73741-type-err.rs:8:7
+   |
+LL |     1 = 2;
+   |     - ^
+   |     |
+   |     cannot assign to this expression
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0070`.