summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/issues
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/issues')
-rw-r--r--tests/ui/async-await/issues/issue-102206.stderr10
-rw-r--r--tests/ui/async-await/issues/issue-107280.stderr20
-rw-r--r--tests/ui/async-await/issues/issue-112225-1.rs18
-rw-r--r--tests/ui/async-await/issues/issue-112225-2.rs20
-rw-r--r--tests/ui/async-await/issues/issue-112225-2.stderr17
-rw-r--r--tests/ui/async-await/issues/issue-51719.stderr4
-rw-r--r--tests/ui/async-await/issues/issue-51751.stderr4
-rw-r--r--tests/ui/async-await/issues/issue-62009-1.stderr20
-rw-r--r--tests/ui/async-await/issues/issue-62009-2.stderr4
-rw-r--r--tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr8
-rw-r--r--tests/ui/async-await/issues/issue-67893.stderr8
-rw-r--r--tests/ui/async-await/issues/non-async-enclosing-span.stderr4
12 files changed, 97 insertions, 40 deletions
diff --git a/tests/ui/async-await/issues/issue-102206.stderr b/tests/ui/async-await/issues/issue-102206.stderr
index 750b7a886..cd8450568 100644
--- a/tests/ui/async-await/issues/issue-102206.stderr
+++ b/tests/ui/async-await/issues/issue-102206.stderr
@@ -2,14 +2,16 @@ error[E0308]: mismatched types
--> $DIR/issue-102206.rs:6:27
|
LL | std::mem::size_of_val(foo());
- | --------------------- ^^^^^
- | | |
- | | expected `&_`, found future
- | | help: consider borrowing here: `&foo()`
+ | --------------------- ^^^^^ expected `&_`, found future
+ | |
| arguments to this function are incorrect
|
note: function defined here
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+help: consider borrowing here
+ |
+LL | std::mem::size_of_val(&foo());
+ | +
error: aborting due to previous error
diff --git a/tests/ui/async-await/issues/issue-107280.stderr b/tests/ui/async-await/issues/issue-107280.stderr
index dd3e10fcc..2e69862a0 100644
--- a/tests/ui/async-await/issues/issue-107280.stderr
+++ b/tests/ui/async-await/issues/issue-107280.stderr
@@ -23,10 +23,10 @@ LL | inner::<false>().await
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:21
+ --> $DIR/issue-107280.rs:4:22
|
LL | inner::<false>().await
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/issue-107280.rs:4:5
@@ -35,10 +35,10 @@ LL | inner::<false>().await
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:21
+ --> $DIR/issue-107280.rs:4:22
|
LL | inner::<false>().await
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/issue-107280.rs:4:5
@@ -47,10 +47,10 @@ LL | inner::<false>().await
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:21
+ --> $DIR/issue-107280.rs:4:22
|
LL | inner::<false>().await
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/issue-107280.rs:4:5
@@ -59,10 +59,10 @@ LL | inner::<false>().await
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:21
+ --> $DIR/issue-107280.rs:4:22
|
LL | inner::<false>().await
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/issue-107280.rs:4:5
@@ -71,10 +71,10 @@ LL | inner::<false>().await
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:21
+ --> $DIR/issue-107280.rs:4:22
|
LL | inner::<false>().await
- | ^^^^^^
+ | ^^^^^
error: aborting due to 6 previous errors
diff --git a/tests/ui/async-await/issues/issue-112225-1.rs b/tests/ui/async-await/issues/issue-112225-1.rs
new file mode 100644
index 000000000..e28cbee21
--- /dev/null
+++ b/tests/ui/async-await/issues/issue-112225-1.rs
@@ -0,0 +1,18 @@
+// check-pass
+// edition:2021
+
+use core::future::Future;
+
+fn main() {
+ do_async(async { (0,) }, {
+ // closure must be inside block
+ |info| println!("{:?}", info.0)
+ });
+}
+
+fn do_async<R, Fut, F>(_tokio_fut: Fut, _glib_closure: F)
+where
+ Fut: Future<Output = R>,
+ F: FnOnce(R),
+{
+}
diff --git a/tests/ui/async-await/issues/issue-112225-2.rs b/tests/ui/async-await/issues/issue-112225-2.rs
new file mode 100644
index 000000000..50fa1a79b
--- /dev/null
+++ b/tests/ui/async-await/issues/issue-112225-2.rs
@@ -0,0 +1,20 @@
+// edition:2021
+
+// With the current compiler logic, we cannot have both the `112225-1` case,
+// and this `112225-2` case working, as the type inference depends on the evaluation
+// order, and there is some explicit ordering going on.
+// See the `check_closures` part in `FnCtxt::check_argument_types`.
+// The `112225-1` case was a regression in real world code, whereas the `112225-2`
+// case never used to work prior to 1.70.
+
+use core::future::Future;
+
+fn main() {
+ let x = Default::default();
+ //~^ ERROR: type annotations needed
+ do_async(
+ async { x.0; },
+ { || { let _: &(i32,) = &x; } },
+ );
+}
+fn do_async<Fut, T>(_fut: Fut, _val: T, ) {}
diff --git a/tests/ui/async-await/issues/issue-112225-2.stderr b/tests/ui/async-await/issues/issue-112225-2.stderr
new file mode 100644
index 000000000..5926a4f39
--- /dev/null
+++ b/tests/ui/async-await/issues/issue-112225-2.stderr
@@ -0,0 +1,17 @@
+error[E0282]: type annotations needed
+ --> $DIR/issue-112225-2.rs:13:9
+ |
+LL | let x = Default::default();
+ | ^
+...
+LL | async { x.0; },
+ | - type must be known at this point
+ |
+help: consider giving `x` an explicit type
+ |
+LL | let x: /* Type */ = Default::default();
+ | ++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/async-await/issues/issue-51719.stderr b/tests/ui/async-await/issues/issue-51719.stderr
index f3ce5d1c8..19cc339ec 100644
--- a/tests/ui/async-await/issues/issue-51719.stderr
+++ b/tests/ui/async-await/issues/issue-51719.stderr
@@ -1,8 +1,8 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/issue-51719.rs:8:24
+ --> $DIR/issue-51719.rs:8:25
|
LL | let _gen = || foo().await;
- | -- ^^^^^^ only allowed inside `async` functions and blocks
+ | -- ^^^^^ only allowed inside `async` functions and blocks
| |
| this is not `async`
diff --git a/tests/ui/async-await/issues/issue-51751.stderr b/tests/ui/async-await/issues/issue-51751.stderr
index 8696a5b79..6dd372660 100644
--- a/tests/ui/async-await/issues/issue-51751.stderr
+++ b/tests/ui/async-await/issues/issue-51751.stderr
@@ -1,11 +1,11 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/issue-51751.rs:9:26
+ --> $DIR/issue-51751.rs:9:27
|
LL | fn main() {
| ---- this is not `async`
LL | let result = inc(10000);
LL | let finished = result.await;
- | ^^^^^^ only allowed inside `async` functions and blocks
+ | ^^^^^ only allowed inside `async` functions and blocks
error: aborting due to previous error
diff --git a/tests/ui/async-await/issues/issue-62009-1.stderr b/tests/ui/async-await/issues/issue-62009-1.stderr
index 222afb2c7..53d0577a1 100644
--- a/tests/ui/async-await/issues/issue-62009-1.stderr
+++ b/tests/ui/async-await/issues/issue-62009-1.stderr
@@ -1,36 +1,36 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/issue-62009-1.rs:6:22
+ --> $DIR/issue-62009-1.rs:6:23
|
LL | fn main() {
| ---- this is not `async`
LL | async { let (); }.await;
- | ^^^^^^ only allowed inside `async` functions and blocks
+ | ^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/issue-62009-1.rs:10:6
+ --> $DIR/issue-62009-1.rs:10:7
|
LL | fn main() {
| ---- this is not `async`
...
LL | }.await;
- | ^^^^^^ only allowed inside `async` functions and blocks
+ | ^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/issue-62009-1.rs:12:15
+ --> $DIR/issue-62009-1.rs:12:16
|
LL | fn main() {
| ---- this is not `async`
...
LL | (|_| 2333).await;
- | ^^^^^^ only allowed inside `async` functions and blocks
+ | ^^^^^ only allowed inside `async` functions and blocks
error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
- --> $DIR/issue-62009-1.rs:12:15
+ --> $DIR/issue-62009-1.rs:12:16
|
LL | (|_| 2333).await;
- | ^^^^^^
- | |
- | `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
+ | -^^^^^
+ | ||
+ | |`[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
| help: remove the `.await`
|
= help: the trait `Future` is not implemented for closure `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]`
diff --git a/tests/ui/async-await/issues/issue-62009-2.stderr b/tests/ui/async-await/issues/issue-62009-2.stderr
index 92e9a8a69..9c2f20df6 100644
--- a/tests/ui/async-await/issues/issue-62009-2.stderr
+++ b/tests/ui/async-await/issues/issue-62009-2.stderr
@@ -1,10 +1,10 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/issue-62009-2.rs:8:22
+ --> $DIR/issue-62009-2.rs:8:23
|
LL | fn main() {
| ---- this is not `async`
LL | (async || 2333)().await;
- | ^^^^^^ only allowed inside `async` functions and blocks
+ | ^^^^^ only allowed inside `async` functions and blocks
error: aborting due to previous error
diff --git a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr
index 8745bdd97..53d326202 100644
--- a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr
+++ b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr
@@ -10,12 +10,12 @@ LL | | })
|
= help: within `[async block@$DIR/issue-65436-raw-ptr-not-send.rs:17:17: 20:6]`, the trait `Send` is not implemented for `*const u8`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-65436-raw-ptr-not-send.rs:19:35
+ --> $DIR/issue-65436-raw-ptr-not-send.rs:19:36
|
LL | bar(Foo(std::ptr::null())).await;
- | ---------------- ^^^^^^- `std::ptr::null()` is later dropped here
- | | |
- | | await occurs here, with `std::ptr::null()` maybe used later
+ | ---------------- ^^^^^- `std::ptr::null()` is later dropped here
+ | | |
+ | | await occurs here, with `std::ptr::null()` maybe used later
| has type `*const u8` which is not `Send`
help: consider moving this into a `let` binding to create a shorter lived borrow
--> $DIR/issue-65436-raw-ptr-not-send.rs:19:13
diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr
index ce9424c8b..c941b9eeb 100644
--- a/tests/ui/async-await/issues/issue-67893.stderr
+++ b/tests/ui/async-await/issues/issue-67893.stderr
@@ -6,12 +6,12 @@ LL | g(issue_67893::run())
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/auxiliary/issue_67893.rs:12:26
+ --> $DIR/auxiliary/issue_67893.rs:12:27
|
LL | f(*x.lock().unwrap()).await;
- | ----------------- ^^^^^^- `x.lock().unwrap()` is later dropped here
- | | |
- | | await occurs here, with `x.lock().unwrap()` maybe used later
+ | ----------------- ^^^^^- `x.lock().unwrap()` is later dropped here
+ | | |
+ | | await occurs here, with `x.lock().unwrap()` maybe used later
| has type `MutexGuard<'_, ()>` which is not `Send`
note: required by a bound in `g`
--> $DIR/issue-67893.rs:6:14
diff --git a/tests/ui/async-await/issues/non-async-enclosing-span.stderr b/tests/ui/async-await/issues/non-async-enclosing-span.stderr
index 20b827479..b6583022c 100644
--- a/tests/ui/async-await/issues/non-async-enclosing-span.stderr
+++ b/tests/ui/async-await/issues/non-async-enclosing-span.stderr
@@ -1,11 +1,11 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/non-async-enclosing-span.rs:9:27
+ --> $DIR/non-async-enclosing-span.rs:9:28
|
LL | fn main() {
| ---- this is not `async`
LL | let x = move || {};
LL | let y = do_the_thing().await;
- | ^^^^^^ only allowed inside `async` functions and blocks
+ | ^^^^^ only allowed inside `async` functions and blocks
error: aborting due to previous error