summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await')
-rw-r--r--tests/ui/async-await/async-await-let-else.drop_tracking.stderr106
-rw-r--r--tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr100
-rw-r--r--tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr90
-rw-r--r--tests/ui/async-await/async-await-let-else.rs6
-rw-r--r--tests/ui/async-await/async-block-control-flow-static-semantics.stderr4
-rw-r--r--tests/ui/async-await/async-error-span.drop_tracking.stderr (renamed from tests/ui/async-await/async-error-span.stderr)6
-rw-r--r--tests/ui/async-await/async-error-span.drop_tracking_mir.stderr24
-rw-r--r--tests/ui/async-await/async-error-span.no_drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/async-error-span.rs7
-rw-r--r--tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr49
-rw-r--r--tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr43
-rw-r--r--tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr120
-rw-r--r--tests/ui/async-await/async-fn-nonsend.rs8
-rw-r--r--tests/ui/async-await/async-fn-nonsend.stderr12
-rw-r--r--tests/ui/async-await/async-fn-path-elision.stderr1
-rw-r--r--tests/ui/async-await/default-struct-update.rs4
-rw-r--r--tests/ui/async-await/dont-suggest-missing-await.stderr12
-rw-r--r--tests/ui/async-await/drop-and-assign.rs4
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr (renamed from tests/ui/async-await/drop-track-field-assign-nonsend.stderr)6
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr23
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.rs4
-rw-r--r--tests/ui/async-await/drop-track-field-assign.rs4
-rw-r--r--tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr23
-rw-r--r--tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/field-assign-nonsend.rs47
-rw-r--r--tests/ui/async-await/field-assign.rs46
-rw-r--r--tests/ui/async-await/future-sizes/async-awaiting-fut.rs24
-rw-r--r--tests/ui/async-await/future-sizes/async-awaiting-fut.stdout72
-rw-r--r--tests/ui/async-await/future-sizes/future-as-arg.rs16
-rw-r--r--tests/ui/async-await/future-sizes/large-arg.rs18
-rw-r--r--tests/ui/async-await/future-sizes/large-arg.stdout60
-rw-r--r--tests/ui/async-await/generator-desc.stderr14
-rw-r--r--tests/ui/async-await/in-trait/async-default-fn-overridden.rs66
-rw-r--r--tests/ui/async-await/in-trait/async-default-fn-overridden.stderr11
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr2
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs71
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr19
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.rs2
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.stderr2
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.stderr2
-rw-r--r--tests/ui/async-await/issue-61076.rs5
-rw-r--r--tests/ui/async-await/issue-61076.stderr17
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr22
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr25
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.rs4
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.stderr6
-rw-r--r--tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr28
-rw-r--r--tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr26
-rw-r--r--tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr28
-rw-r--r--tests/ui/async-await/issue-64130-2-send.rs5
-rw-r--r--tests/ui/async-await/issue-64130-2-send.stderr6
-rw-r--r--tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr27
-rw-r--r--tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr25
-rw-r--r--tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr27
-rw-r--r--tests/ui/async-await/issue-64130-3-other.rs5
-rw-r--r--tests/ui/async-await/issue-64130-3-other.stderr6
-rw-r--r--tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr6
-rw-r--r--tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr6
-rw-r--r--tests/ui/async-await/issue-64130-4-async-move.rs8
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr30
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr22
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr30
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.rs6
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.stderr28
-rw-r--r--tests/ui/async-await/issue-68112.drop_tracking.stderr3
-rw-r--r--tests/ui/async-await/issue-68112.drop_tracking_mir.stderr80
-rw-r--r--tests/ui/async-await/issue-68112.no_drop_tracking.stderr3
-rw-r--r--tests/ui/async-await/issue-68112.rs8
-rw-r--r--tests/ui/async-await/issue-70818.drop_tracking.stderr18
-rw-r--r--tests/ui/async-await/issue-70818.drop_tracking_mir.stderr18
-rw-r--r--tests/ui/async-await/issue-70818.no_drop_tracking.stderr18
-rw-r--r--tests/ui/async-await/issue-70818.rs3
-rw-r--r--tests/ui/async-await/issue-70818.stderr4
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr34
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.rs8
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr11
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr11
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr11
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.rs5
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr2
-rw-r--r--tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr16
-rw-r--r--tests/ui/async-await/issue-75785-confusing-named-region.stderr4
-rw-r--r--tests/ui/async-await/issue-86507.drop_tracking.stderr (renamed from tests/ui/async-await/issue-86507.stderr)6
-rw-r--r--tests/ui/async-await/issue-86507.drop_tracking_mir.stderr23
-rw-r--r--tests/ui/async-await/issue-86507.no_drop_tracking.stderr23
-rw-r--r--tests/ui/async-await/issue-86507.rs3
-rw-r--r--tests/ui/async-await/issue-93648.rs4
-rw-r--r--tests/ui/async-await/issue-98634.rs6
-rw-r--r--tests/ui/async-await/issue-98634.stderr33
-rw-r--r--tests/ui/async-await/issues/auxiliary/issue_67893.rs3
-rw-r--r--tests/ui/async-await/issues/issue-102206.stderr9
-rw-r--r--tests/ui/async-await/issues/issue-107280.rs15
-rw-r--r--tests/ui/async-await/issues/issue-107280.stderr82
-rw-r--r--tests/ui/async-await/issues/issue-62097.rs2
-rw-r--r--tests/ui/async-await/issues/issue-62097.stderr6
-rw-r--r--tests/ui/async-await/issues/issue-65159.rs2
-rw-r--r--tests/ui/async-await/issues/issue-65159.stderr2
-rw-r--r--tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr10
-rw-r--r--tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs7
-rw-r--r--tests/ui/async-await/issues/issue-67611-static-mut-refs.rs4
-rw-r--r--tests/ui/async-await/issues/issue-67893.stderr2
-rw-r--r--tests/ui/async-await/issues/issue-72312.stderr6
-rw-r--r--tests/ui/async-await/multiple-lifetimes/member-constraints-min-choice-issue-63033.rs10
-rw-r--r--tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr5
-rw-r--r--tests/ui/async-await/multiple-lifetimes/ret-ref.stderr12
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr21
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr21
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr21
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs4
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr4
-rw-r--r--tests/ui/async-await/no-const-async.stderr4
-rw-r--r--tests/ui/async-await/non-trivial-drop.rs4
-rw-r--r--tests/ui/async-await/proper-span-for-type-error.stderr2
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr12
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr12
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr12
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.rs3
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.stderr2
-rw-r--r--tests/ui/async-await/send-bound-async-closure.rs37
-rw-r--r--tests/ui/async-await/suggest-missing-await-closure.stderr12
-rw-r--r--tests/ui/async-await/suggest-missing-await.stderr59
-rw-r--r--tests/ui/async-await/unresolved_type_param.drop_tracking.stderr39
-rw-r--r--tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr14
-rw-r--r--tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr63
-rw-r--r--tests/ui/async-await/unresolved_type_param.rs38
-rw-r--r--tests/ui/async-await/unresolved_type_param.stderr12
129 files changed, 2300 insertions, 279 deletions
diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.drop_tracking.stderr
new file mode 100644
index 000000000..fb83ca90a
--- /dev/null
+++ b/tests/ui/async-await/async-await-let-else.drop_tracking.stderr
@@ -0,0 +1,106 @@
+error: future cannot be sent between threads safely
+ --> $DIR/async-await-let-else.rs:48:13
+ |
+LL | is_send(foo(Some(true)));
+ | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-await-let-else.rs:11:14
+ |
+LL | let r = Rc::new(());
+ | - has type `Rc<()>` which is not `Send`
+LL | bar().await
+ | ^^^^^^ await occurs here, with `r` maybe used later
+LL | };
+ | - `r` is later dropped here
+note: required by a bound in `is_send`
+ --> $DIR/async-await-let-else.rs:19:15
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `is_send`
+
+error[E0277]: `Rc<()>` cannot be sent between threads safely
+ --> $DIR/async-await-let-else.rs:50:13
+ |
+LL | async fn foo2(x: Option<bool>) {
+ | - within this `impl Future<Output = ()>`
+...
+LL | is_send(foo2(Some(true)));
+ | ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: required because it's used within this `async fn` body
+ --> $DIR/async-await-let-else.rs:27:29
+ |
+LL | async fn bar2<T>(_: T) -> ! {
+ | _____________________________^
+LL | | panic!()
+LL | | }
+ | |_^
+ = note: required because it captures the following types: `ResumeTy`, `Option<bool>`, `impl Future<Output = !>`, `()`
+note: required because it's used within this `async fn` body
+ --> $DIR/async-await-let-else.rs:21:32
+ |
+LL | async fn foo2(x: Option<bool>) {
+ | ________________________________^
+LL | | let Some(_) = x else {
+LL | | bar2(Rc::new(())).await
+LL | | };
+LL | | }
+ | |_^
+note: required by a bound in `is_send`
+ --> $DIR/async-await-let-else.rs:19:15
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-await-let-else.rs:52:13
+ |
+LL | is_send(foo3(Some(true)));
+ | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-await-let-else.rs:33:28
+ |
+LL | (Rc::new(()), bar().await);
+ | ----------- ^^^^^^ - `Rc::new(())` is later dropped here
+ | | |
+ | | await occurs here, with `Rc::new(())` maybe used later
+ | has type `Rc<()>` which is not `Send`
+note: required by a bound in `is_send`
+ --> $DIR/async-await-let-else.rs:19:15
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-await-let-else.rs:54:13
+ |
+LL | is_send(foo4(Some(true)));
+ | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-await-let-else.rs:41:14
+ |
+LL | let r = Rc::new(());
+ | - has type `Rc<()>` which is not `Send`
+LL | bar().await;
+ | ^^^^^^ await occurs here, with `r` maybe used later
+...
+LL | };
+ | - `r` is later dropped here
+note: required by a bound in `is_send`
+ --> $DIR/async-await-let-else.rs:19:15
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr b/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr
new file mode 100644
index 000000000..c284bbfb1
--- /dev/null
+++ b/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr
@@ -0,0 +1,100 @@
+error: future cannot be sent between threads safely
+ --> $DIR/async-await-let-else.rs:48:13
+ |
+LL | is_send(foo(Some(true)));
+ | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-await-let-else.rs:11:14
+ |
+LL | let r = Rc::new(());
+ | - has type `Rc<()>` which is not `Send`
+LL | bar().await
+ | ^^^^^^ await occurs here, with `r` maybe used later
+note: required by a bound in `is_send`
+ --> $DIR/async-await-let-else.rs:19:15
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `is_send`
+
+error[E0277]: `Rc<()>` cannot be sent between threads safely
+ --> $DIR/async-await-let-else.rs:50:13
+ |
+LL | async fn foo2(x: Option<bool>) {
+ | - within this `impl Future<Output = ()>`
+...
+LL | is_send(foo2(Some(true)));
+ | ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: required because it's used within this `async fn` body
+ --> $DIR/async-await-let-else.rs:27:29
+ |
+LL | async fn bar2<T>(_: T) -> ! {
+ | _____________________________^
+LL | | panic!()
+LL | | }
+ | |_^
+ = note: required because it captures the following types: `impl Future<Output = !>`
+note: required because it's used within this `async fn` body
+ --> $DIR/async-await-let-else.rs:21:32
+ |
+LL | async fn foo2(x: Option<bool>) {
+ | ________________________________^
+LL | | let Some(_) = x else {
+LL | | bar2(Rc::new(())).await
+LL | | };
+LL | | }
+ | |_^
+note: required by a bound in `is_send`
+ --> $DIR/async-await-let-else.rs:19:15
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-await-let-else.rs:52:13
+ |
+LL | is_send(foo3(Some(true)));
+ | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-await-let-else.rs:33:28
+ |
+LL | (Rc::new(()), bar().await);
+ | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
+ | |
+ | has type `Rc<()>` which is not `Send`
+note: required by a bound in `is_send`
+ --> $DIR/async-await-let-else.rs:19:15
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-await-let-else.rs:54:13
+ |
+LL | is_send(foo4(Some(true)));
+ | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-await-let-else.rs:41:14
+ |
+LL | let r = Rc::new(());
+ | - has type `Rc<()>` which is not `Send`
+LL | bar().await;
+ | ^^^^^^ await occurs here, with `r` maybe used later
+note: required by a bound in `is_send`
+ --> $DIR/async-await-let-else.rs:19:15
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr
new file mode 100644
index 000000000..d3c5e80a3
--- /dev/null
+++ b/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr
@@ -0,0 +1,90 @@
+error: future cannot be sent between threads safely
+ --> $DIR/async-await-let-else.rs:48:13
+ |
+LL | is_send(foo(Some(true)));
+ | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-await-let-else.rs:11:14
+ |
+LL | let r = Rc::new(());
+ | - has type `Rc<()>` which is not `Send`
+LL | bar().await
+ | ^^^^^^ await occurs here, with `r` maybe used later
+LL | };
+ | - `r` is later dropped here
+note: required by a bound in `is_send`
+ --> $DIR/async-await-let-else.rs:19:15
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-await-let-else.rs:50:13
+ |
+LL | is_send(foo2(Some(true)));
+ | ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-await-let-else.rs:23:26
+ |
+LL | bar2(Rc::new(())).await
+ | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
+ | |
+ | has type `Rc<()>` which is not `Send`
+LL | };
+ | - `Rc::new(())` is later dropped here
+note: required by a bound in `is_send`
+ --> $DIR/async-await-let-else.rs:19:15
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-await-let-else.rs:52:13
+ |
+LL | is_send(foo3(Some(true)));
+ | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-await-let-else.rs:33:28
+ |
+LL | (Rc::new(()), bar().await);
+ | ----------- ^^^^^^ - `Rc::new(())` is later dropped here
+ | | |
+ | | await occurs here, with `Rc::new(())` maybe used later
+ | has type `Rc<()>` which is not `Send`
+note: required by a bound in `is_send`
+ --> $DIR/async-await-let-else.rs:19:15
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-await-let-else.rs:54:13
+ |
+LL | is_send(foo4(Some(true)));
+ | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-await-let-else.rs:41:14
+ |
+LL | let r = Rc::new(());
+ | - has type `Rc<()>` which is not `Send`
+LL | bar().await;
+ | ^^^^^^ await occurs here, with `r` maybe used later
+...
+LL | };
+ | - `r` is later dropped here
+note: required by a bound in `is_send`
+ --> $DIR/async-await-let-else.rs:19:15
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `is_send`
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/async-await/async-await-let-else.rs b/tests/ui/async-await/async-await-let-else.rs
index 3fb2142b9..113d576b5 100644
--- a/tests/ui/async-await/async-await-let-else.rs
+++ b/tests/ui/async-await/async-await-let-else.rs
@@ -1,7 +1,7 @@
// edition:2021
-// revisions: drop-tracking no-drop-tracking
-// [drop-tracking] compile-flags: -Zdrop-tracking=yes
-// [no-drop-tracking] compile-flags: -Zdrop-tracking=no
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
use std::rc::Rc;
diff --git a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr
index c4487eb84..a6dbb0716 100644
--- a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr
+++ b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr
@@ -57,7 +57,7 @@ error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:49:44
|
LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
- | ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
+ | ---------------------------------- ^^^^^^^^^^^^^^^^^ expected `Result<u8, MyErr>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
@@ -68,7 +68,7 @@ error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:58:50
|
LL | fn rethrow_targets_async_block_not_async_fn() -> Result<u8, MyErr> {
- | ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
+ | ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected `Result<u8, MyErr>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
diff --git a/tests/ui/async-await/async-error-span.stderr b/tests/ui/async-await/async-error-span.drop_tracking.stderr
index 7d4447b6d..c6257cb32 100644
--- a/tests/ui/async-await/async-error-span.stderr
+++ b/tests/ui/async-await/async-error-span.drop_tracking.stderr
@@ -1,5 +1,5 @@
error[E0277]: `()` is not a future
- --> $DIR/async-error-span.rs:7:20
+ --> $DIR/async-error-span.rs:10:20
|
LL | fn get_future() -> impl Future<Output = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
@@ -8,13 +8,13 @@ LL | fn get_future() -> impl Future<Output = ()> {
= note: () must be a future or must implement `IntoFuture` to be awaited
error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/async-error-span.rs:13:9
+ --> $DIR/async-error-span.rs:16:9
|
LL | let a;
| ^ cannot infer type
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/async-error-span.rs:14:17
+ --> $DIR/async-error-span.rs:19:17
|
LL | get_future().await;
| ^^^^^^
diff --git a/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr b/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr
new file mode 100644
index 000000000..2f29ee6cd
--- /dev/null
+++ b/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr
@@ -0,0 +1,24 @@
+error[E0277]: `()` is not a future
+ --> $DIR/async-error-span.rs:10:20
+ |
+LL | fn get_future() -> impl Future<Output = ()> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
+ |
+ = help: the trait `Future` is not implemented for `()`
+ = note: () must be a future or must implement `IntoFuture` to be awaited
+
+error[E0282]: type annotations needed
+ --> $DIR/async-error-span.rs:16:9
+ |
+LL | let a;
+ | ^
+ |
+help: consider giving `a` an explicit type
+ |
+LL | let a: /* Type */;
+ | ++++++++++++
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0277, E0282.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/async-error-span.no_drop_tracking.stderr b/tests/ui/async-await/async-error-span.no_drop_tracking.stderr
new file mode 100644
index 000000000..c6257cb32
--- /dev/null
+++ b/tests/ui/async-await/async-error-span.no_drop_tracking.stderr
@@ -0,0 +1,25 @@
+error[E0277]: `()` is not a future
+ --> $DIR/async-error-span.rs:10:20
+ |
+LL | fn get_future() -> impl Future<Output = ()> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
+ |
+ = help: the trait `Future` is not implemented for `()`
+ = note: () must be a future or must implement `IntoFuture` to be awaited
+
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/async-error-span.rs:16:9
+ |
+LL | let a;
+ | ^ cannot infer type
+ |
+note: the type is part of the `async fn` body because of this `await`
+ --> $DIR/async-error-span.rs:19:17
+ |
+LL | get_future().await;
+ | ^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0277, E0698.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/async-error-span.rs b/tests/ui/async-await/async-error-span.rs
index 86d459bf0..c9ecf359e 100644
--- a/tests/ui/async-await/async-error-span.rs
+++ b/tests/ui/async-await/async-error-span.rs
@@ -1,3 +1,6 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
// Regression test for issue #62382.
@@ -10,7 +13,9 @@ fn get_future() -> impl Future<Output = ()> {
}
async fn foo() {
- let a; //~ ERROR type inside `async fn` body must be known in this context
+ let a;
+ //[no_drop_tracking,drop_tracking]~^ ERROR type inside `async fn` body must be known in this context
+ //[drop_tracking_mir]~^^ ERROR type annotations needed
get_future().await;
}
diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr
new file mode 100644
index 000000000..0f0dc335e
--- /dev/null
+++ b/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr
@@ -0,0 +1,49 @@
+error: future cannot be sent between threads safely
+ --> $DIR/async-fn-nonsend.rs:72:17
+ |
+LL | assert_send(non_send_temporary_in_match());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-fn-nonsend.rs:36:25
+ |
+LL | match Some(non_send()) {
+ | ---------------- has type `Option<impl Debug>` which is not `Send`
+LL | Some(_) => fut().await,
+ | ^^^^^^ await occurs here, with `Some(non_send())` maybe used later
+...
+LL | }
+ | - `Some(non_send())` is later dropped here
+note: required by a bound in `assert_send`
+ --> $DIR/async-fn-nonsend.rs:67:24
+ |
+LL | fn assert_send(_: impl Send) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-fn-nonsend.rs:74:17
+ |
+LL | assert_send(non_sync_with_method_call());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-fn-nonsend.rs:49:14
+ |
+LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
+ | --------------- has type `Formatter<'_>` which is not `Send`
+...
+LL | fut().await;
+ | ^^^^^^ await occurs here, with `get_formatter()` maybe used later
+LL | }
+LL | }
+ | - `get_formatter()` is later dropped here
+note: required by a bound in `assert_send`
+ --> $DIR/async-fn-nonsend.rs:67:24
+ |
+LL | fn assert_send(_: impl Send) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr
new file mode 100644
index 000000000..57a012801
--- /dev/null
+++ b/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr
@@ -0,0 +1,43 @@
+error: future cannot be sent between threads safely
+ --> $DIR/async-fn-nonsend.rs:72:17
+ |
+LL | assert_send(non_send_temporary_in_match());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-fn-nonsend.rs:36:25
+ |
+LL | match Some(non_send()) {
+ | ---------------- has type `Option<impl Debug>` which is not `Send`
+LL | Some(_) => fut().await,
+ | ^^^^^^ await occurs here, with `Some(non_send())` maybe used later
+note: required by a bound in `assert_send`
+ --> $DIR/async-fn-nonsend.rs:67:24
+ |
+LL | fn assert_send(_: impl Send) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-fn-nonsend.rs:74:17
+ |
+LL | assert_send(non_sync_with_method_call());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-fn-nonsend.rs:49:14
+ |
+LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
+ | --------------- has type `Formatter<'_>` which is not `Send`
+...
+LL | fut().await;
+ | ^^^^^^ await occurs here, with `get_formatter()` maybe used later
+note: required by a bound in `assert_send`
+ --> $DIR/async-fn-nonsend.rs:67:24
+ |
+LL | fn assert_send(_: impl Send) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr
new file mode 100644
index 000000000..5cec21d89
--- /dev/null
+++ b/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr
@@ -0,0 +1,120 @@
+error: future cannot be sent between threads safely
+ --> $DIR/async-fn-nonsend.rs:70:17
+ |
+LL | assert_send(local_dropped_before_await());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-fn-nonsend.rs:27:10
+ |
+LL | let x = non_send();
+ | - has type `impl Debug` which is not `Send`
+LL | drop(x);
+LL | fut().await;
+ | ^^^^^^ await occurs here, with `x` maybe used later
+LL | }
+ | - `x` is later dropped here
+note: required by a bound in `assert_send`
+ --> $DIR/async-fn-nonsend.rs:67:24
+ |
+LL | fn assert_send(_: impl Send) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-fn-nonsend.rs:72:17
+ |
+LL | assert_send(non_send_temporary_in_match());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-fn-nonsend.rs:36:25
+ |
+LL | match Some(non_send()) {
+ | ---------- has type `impl Debug` which is not `Send`
+LL | Some(_) => fut().await,
+ | ^^^^^^ await occurs here, with `non_send()` maybe used later
+...
+LL | }
+ | - `non_send()` is later dropped here
+note: required by a bound in `assert_send`
+ --> $DIR/async-fn-nonsend.rs:67:24
+ |
+LL | fn assert_send(_: impl Send) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-fn-nonsend.rs:74:17
+ |
+LL | assert_send(non_sync_with_method_call());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-fn-nonsend.rs:49:14
+ |
+LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
+ | --------------- has type `Formatter<'_>` which is not `Send`
+...
+LL | fut().await;
+ | ^^^^^^ await occurs here, with `get_formatter()` maybe used later
+LL | }
+LL | }
+ | - `get_formatter()` is later dropped here
+note: required by a bound in `assert_send`
+ --> $DIR/async-fn-nonsend.rs:67:24
+ |
+LL | fn assert_send(_: impl Send) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-fn-nonsend.rs:76:17
+ |
+LL | assert_send(non_sync_with_method_call_panic());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_panic` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-fn-nonsend.rs:56:14
+ |
+LL | let f: &mut std::fmt::Formatter = panic!();
+ | - has type `&mut Formatter<'_>` which is not `Send`
+LL | if non_sync().fmt(f).unwrap() == () {
+LL | fut().await;
+ | ^^^^^^ await occurs here, with `f` maybe used later
+LL | }
+LL | }
+ | - `f` is later dropped here
+note: required by a bound in `assert_send`
+ --> $DIR/async-fn-nonsend.rs:67:24
+ |
+LL | fn assert_send(_: impl Send) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/async-fn-nonsend.rs:78:17
+ |
+LL | assert_send(non_sync_with_method_call_infinite_loop());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_infinite_loop` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/async-fn-nonsend.rs:63:14
+ |
+LL | let f: &mut std::fmt::Formatter = loop {};
+ | - has type `&mut Formatter<'_>` which is not `Send`
+LL | if non_sync().fmt(f).unwrap() == () {
+LL | fut().await;
+ | ^^^^^^ await occurs here, with `f` maybe used later
+LL | }
+LL | }
+ | - `f` is later dropped here
+note: required by a bound in `assert_send`
+ --> $DIR/async-fn-nonsend.rs:67:24
+ |
+LL | fn assert_send(_: impl Send) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: aborting due to 5 previous errors
+
diff --git a/tests/ui/async-await/async-fn-nonsend.rs b/tests/ui/async-await/async-fn-nonsend.rs
index d7f8d7ac5..ed440bd01 100644
--- a/tests/ui/async-await/async-fn-nonsend.rs
+++ b/tests/ui/async-await/async-fn-nonsend.rs
@@ -1,5 +1,8 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
-// compile-flags: --crate-type lib -Zdrop-tracking
+// compile-flags: --crate-type lib
use std::{cell::RefCell, fmt::Debug, rc::Rc};
@@ -65,10 +68,13 @@ fn assert_send(_: impl Send) {}
pub fn pass_assert() {
assert_send(local_dropped_before_await());
+ //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
assert_send(non_send_temporary_in_match());
//~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call());
//~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call_panic());
+ //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call_infinite_loop());
+ //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
}
diff --git a/tests/ui/async-await/async-fn-nonsend.stderr b/tests/ui/async-await/async-fn-nonsend.stderr
index a7b872fe4..0f0dc335e 100644
--- a/tests/ui/async-await/async-fn-nonsend.stderr
+++ b/tests/ui/async-await/async-fn-nonsend.stderr
@@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:68:17
+ --> $DIR/async-fn-nonsend.rs:72:17
|
LL | assert_send(non_send_temporary_in_match());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:33:25
+ --> $DIR/async-fn-nonsend.rs:36:25
|
LL | match Some(non_send()) {
| ---------------- has type `Option<impl Debug>` which is not `Send`
@@ -16,20 +16,20 @@ LL | Some(_) => fut().await,
LL | }
| - `Some(non_send())` is later dropped here
note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:64:24
+ --> $DIR/async-fn-nonsend.rs:67:24
|
LL | fn assert_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_send`
error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:70:17
+ --> $DIR/async-fn-nonsend.rs:74:17
|
LL | assert_send(non_sync_with_method_call());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:46:14
+ --> $DIR/async-fn-nonsend.rs:49:14
|
LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
| --------------- has type `Formatter<'_>` which is not `Send`
@@ -40,7 +40,7 @@ LL | }
LL | }
| - `get_formatter()` is later dropped here
note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:64:24
+ --> $DIR/async-fn-nonsend.rs:67:24
|
LL | fn assert_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/async-await/async-fn-path-elision.stderr b/tests/ui/async-await/async-fn-path-elision.stderr
index 5e0c8c299..224198653 100644
--- a/tests/ui/async-await/async-fn-path-elision.stderr
+++ b/tests/ui/async-await/async-fn-path-elision.stderr
@@ -4,7 +4,6 @@ error[E0726]: implicit elided lifetime not allowed here
LL | async fn error(lt: HasLifetime) {
| ^^^^^^^^^^^ expected lifetime parameter
|
- = note: assuming a `'static` lifetime...
help: indicate the anonymous lifetime
|
LL | async fn error(lt: HasLifetime<'_>) {
diff --git a/tests/ui/async-await/default-struct-update.rs b/tests/ui/async-await/default-struct-update.rs
index 64fb6280d..daee8469a 100644
--- a/tests/ui/async-await/default-struct-update.rs
+++ b/tests/ui/async-await/default-struct-update.rs
@@ -1,6 +1,8 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// build-pass
// edition:2018
-// compile-flags: -Zdrop-tracking=y
fn main() {
let _ = foo();
diff --git a/tests/ui/async-await/dont-suggest-missing-await.stderr b/tests/ui/async-await/dont-suggest-missing-await.stderr
index 627bf05bb..1fa4e5db0 100644
--- a/tests/ui/async-await/dont-suggest-missing-await.stderr
+++ b/tests/ui/async-await/dont-suggest-missing-await.stderr
@@ -2,17 +2,15 @@ error[E0308]: mismatched types
--> $DIR/dont-suggest-missing-await.rs:14:18
|
LL | take_u32(x)
- | -------- ^ expected `u32`, found opaque type
+ | -------- ^ expected `u32`, found future
| |
| arguments to this function are incorrect
|
-note: while checking the return type of the `async fn`
- --> $DIR/dont-suggest-missing-await.rs:7:24
+note: calling an async function returns a future
+ --> $DIR/dont-suggest-missing-await.rs:14:18
|
-LL | async fn make_u32() -> u32 {
- | ^^^ checked the `Output` of this `async fn`, found opaque type
- = note: expected type `u32`
- found opaque type `impl Future<Output = u32>`
+LL | take_u32(x)
+ | ^
note: function defined here
--> $DIR/dont-suggest-missing-await.rs:5:4
|
diff --git a/tests/ui/async-await/drop-and-assign.rs b/tests/ui/async-await/drop-and-assign.rs
index fa3f33036..e520dfbdc 100644
--- a/tests/ui/async-await/drop-and-assign.rs
+++ b/tests/ui/async-await/drop-and-assign.rs
@@ -1,5 +1,7 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2021
-// compile-flags: -Zdrop-tracking
// build-pass
struct A;
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr
index d95483c81..e2bba812d 100644
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.stderr
+++ b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr
@@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/drop-track-field-assign-nonsend.rs:43:17
+ --> $DIR/drop-track-field-assign-nonsend.rs:45:17
|
LL | assert_send(agent.handle());
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
note: future is not `Send` as this value is used across an await
- --> $DIR/drop-track-field-assign-nonsend.rs:21:38
+ --> $DIR/drop-track-field-assign-nonsend.rs:23:38
|
LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send`
@@ -16,7 +16,7 @@ LL | let _ = send_element(element).await;
LL | }
| - `mut info` is later dropped here
note: required by a bound in `assert_send`
- --> $DIR/drop-track-field-assign-nonsend.rs:38:19
+ --> $DIR/drop-track-field-assign-nonsend.rs:40:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr
new file mode 100644
index 000000000..b89d86804
--- /dev/null
+++ b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr
@@ -0,0 +1,23 @@
+error: future cannot be sent between threads safely
+ --> $DIR/drop-track-field-assign-nonsend.rs:45:17
+ |
+LL | assert_send(agent.handle());
+ | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/drop-track-field-assign-nonsend.rs:23:38
+ |
+LL | let mut info = self.info_result.clone();
+ | -------- has type `InfoResult` which is not `Send`
+...
+LL | let _ = send_element(element).await;
+ | ^^^^^^ await occurs here, with `mut info` maybe used later
+note: required by a bound in `assert_send`
+ --> $DIR/drop-track-field-assign-nonsend.rs:40:19
+ |
+LL | fn assert_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr
new file mode 100644
index 000000000..e2bba812d
--- /dev/null
+++ b/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr
@@ -0,0 +1,25 @@
+error: future cannot be sent between threads safely
+ --> $DIR/drop-track-field-assign-nonsend.rs:45:17
+ |
+LL | assert_send(agent.handle());
+ | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/drop-track-field-assign-nonsend.rs:23:38
+ |
+LL | let mut info = self.info_result.clone();
+ | -------- has type `InfoResult` which is not `Send`
+...
+LL | let _ = send_element(element).await;
+ | ^^^^^^ await occurs here, with `mut info` maybe used later
+LL | }
+ | - `mut info` is later dropped here
+note: required by a bound in `assert_send`
+ --> $DIR/drop-track-field-assign-nonsend.rs:40:19
+ |
+LL | fn assert_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.rs b/tests/ui/async-await/drop-track-field-assign-nonsend.rs
index b6c0fda15..3e2228000 100644
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.rs
+++ b/tests/ui/async-await/drop-track-field-assign-nonsend.rs
@@ -1,6 +1,8 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// Derived from an ICE found in tokio-xmpp during a crater run.
// edition:2021
-// compile-flags: -Zdrop-tracking
#![allow(dead_code)]
diff --git a/tests/ui/async-await/drop-track-field-assign.rs b/tests/ui/async-await/drop-track-field-assign.rs
index 3a393cd16..dd0e3f11c 100644
--- a/tests/ui/async-await/drop-track-field-assign.rs
+++ b/tests/ui/async-await/drop-track-field-assign.rs
@@ -1,6 +1,8 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// Derived from an ICE found in tokio-xmpp during a crater run.
// edition:2021
-// compile-flags: -Zdrop-tracking
// build-pass
#![allow(dead_code)]
diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr
new file mode 100644
index 000000000..ac461a671
--- /dev/null
+++ b/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr
@@ -0,0 +1,25 @@
+error: future cannot be sent between threads safely
+ --> $DIR/field-assign-nonsend.rs:45:17
+ |
+LL | assert_send(agent.handle());
+ | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/field-assign-nonsend.rs:23:38
+ |
+LL | let mut info = self.info_result.clone();
+ | -------- has type `InfoResult` which is not `Send`
+...
+LL | let _ = send_element(element).await;
+ | ^^^^^^ await occurs here, with `mut info` maybe used later
+LL | }
+ | - `mut info` is later dropped here
+note: required by a bound in `assert_send`
+ --> $DIR/field-assign-nonsend.rs:40:19
+ |
+LL | fn assert_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr
new file mode 100644
index 000000000..8c9d14d62
--- /dev/null
+++ b/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr
@@ -0,0 +1,23 @@
+error: future cannot be sent between threads safely
+ --> $DIR/field-assign-nonsend.rs:45:17
+ |
+LL | assert_send(agent.handle());
+ | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/field-assign-nonsend.rs:23:38
+ |
+LL | let mut info = self.info_result.clone();
+ | -------- has type `InfoResult` which is not `Send`
+...
+LL | let _ = send_element(element).await;
+ | ^^^^^^ await occurs here, with `mut info` maybe used later
+note: required by a bound in `assert_send`
+ --> $DIR/field-assign-nonsend.rs:40:19
+ |
+LL | fn assert_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr
new file mode 100644
index 000000000..ac461a671
--- /dev/null
+++ b/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr
@@ -0,0 +1,25 @@
+error: future cannot be sent between threads safely
+ --> $DIR/field-assign-nonsend.rs:45:17
+ |
+LL | assert_send(agent.handle());
+ | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/field-assign-nonsend.rs:23:38
+ |
+LL | let mut info = self.info_result.clone();
+ | -------- has type `InfoResult` which is not `Send`
+...
+LL | let _ = send_element(element).await;
+ | ^^^^^^ await occurs here, with `mut info` maybe used later
+LL | }
+ | - `mut info` is later dropped here
+note: required by a bound in `assert_send`
+ --> $DIR/field-assign-nonsend.rs:40:19
+ |
+LL | fn assert_send<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `assert_send`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/field-assign-nonsend.rs b/tests/ui/async-await/field-assign-nonsend.rs
new file mode 100644
index 000000000..3e2228000
--- /dev/null
+++ b/tests/ui/async-await/field-assign-nonsend.rs
@@ -0,0 +1,47 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
+// Derived from an ICE found in tokio-xmpp during a crater run.
+// edition:2021
+
+#![allow(dead_code)]
+
+#[derive(Clone)]
+struct InfoResult {
+ node: Option<std::rc::Rc<String>>
+}
+
+struct Agent {
+ info_result: InfoResult
+}
+
+impl Agent {
+ async fn handle(&mut self) {
+ let mut info = self.info_result.clone();
+ info.node = None;
+ let element = parse_info(info);
+ let _ = send_element(element).await;
+ }
+}
+
+struct Element {
+}
+
+async fn send_element(_: Element) {}
+
+fn parse(_: &[u8]) -> Result<(), ()> {
+ Ok(())
+}
+
+fn parse_info(_: InfoResult) -> Element {
+ Element { }
+}
+
+fn assert_send<T: Send>(_: T) {}
+
+fn main() {
+ let agent = Agent { info_result: InfoResult { node: None } };
+ // FIXME: It would be nice for this to work. See #94067.
+ assert_send(agent.handle());
+ //~^ cannot be sent between threads safely
+}
diff --git a/tests/ui/async-await/field-assign.rs b/tests/ui/async-await/field-assign.rs
new file mode 100644
index 000000000..dd0e3f11c
--- /dev/null
+++ b/tests/ui/async-await/field-assign.rs
@@ -0,0 +1,46 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
+// Derived from an ICE found in tokio-xmpp during a crater run.
+// edition:2021
+// build-pass
+
+#![allow(dead_code)]
+
+#[derive(Clone)]
+struct InfoResult {
+ node: Option<String>
+}
+
+struct Agent {
+ info_result: InfoResult
+}
+
+impl Agent {
+ async fn handle(&mut self) {
+ let mut info = self.info_result.clone();
+ info.node = Some("bar".into());
+ let element = parse_info(info);
+ let _ = send_element(element).await;
+ }
+}
+
+struct Element {
+}
+
+async fn send_element(_: Element) {}
+
+fn parse(_: &[u8]) -> Result<(), ()> {
+ Ok(())
+}
+
+fn parse_info(_: InfoResult) -> Element {
+ Element { }
+}
+
+fn main() {
+ let mut agent = Agent {
+ info_result: InfoResult { node: None }
+ };
+ let _ = agent.handle();
+}
diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.rs b/tests/ui/async-await/future-sizes/async-awaiting-fut.rs
new file mode 100644
index 000000000..1816d842d
--- /dev/null
+++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.rs
@@ -0,0 +1,24 @@
+// compile-flags: -Z print-type-sizes --crate-type lib
+// edition:2021
+// build-pass
+// ignore-pass
+
+async fn wait() {}
+
+async fn big_fut(arg: [u8; 1024]) {}
+
+async fn calls_fut(fut: impl std::future::Future<Output = ()>) {
+ loop {
+ wait().await;
+ if true {
+ return fut.await;
+ } else {
+ wait().await;
+ }
+ }
+}
+
+pub async fn test() {
+ let fut = big_fut([0u8; 1024]);
+ calls_fut(fut).await;
+}
diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
new file mode 100644
index 000000000..eaf3e4b61
--- /dev/null
+++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
@@ -0,0 +1,72 @@
+print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:21:21: 24:2]`: 3078 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 0 bytes
+print-type-size variant `Suspend0`: 3077 bytes
+print-type-size local `.__awaitee`: 3077 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size variant `Returned`: 0 bytes
+print-type-size variant `Panicked`: 0 bytes
+print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]`: 3077 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 2051 bytes
+print-type-size padding: 1026 bytes
+print-type-size upvar `.fut`: 1025 bytes, alignment: 1 bytes
+print-type-size variant `Suspend0`: 2052 bytes
+print-type-size local `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size local `..generator_field4`: 1 bytes
+print-type-size padding: 1 bytes
+print-type-size upvar `.fut`: 1025 bytes, alignment: 1 bytes
+print-type-size local `.__awaitee`: 1 bytes
+print-type-size variant `Suspend1`: 3076 bytes
+print-type-size padding: 1024 bytes
+print-type-size local `..generator_field4`: 1 bytes, alignment: 1 bytes
+print-type-size padding: 1 bytes
+print-type-size upvar `.fut`: 1025 bytes, alignment: 1 bytes
+print-type-size local `.__awaitee`: 1025 bytes
+print-type-size variant `Suspend2`: 2052 bytes
+print-type-size local `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size local `..generator_field4`: 1 bytes
+print-type-size padding: 1 bytes
+print-type-size upvar `.fut`: 1025 bytes, alignment: 1 bytes
+print-type-size local `.__awaitee`: 1 bytes
+print-type-size variant `Returned`: 2051 bytes
+print-type-size padding: 1026 bytes
+print-type-size upvar `.fut`: 1025 bytes, alignment: 1 bytes
+print-type-size variant `Panicked`: 2051 bytes
+print-type-size padding: 1026 bytes
+print-type-size upvar `.fut`: 1025 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]>`: 3077 bytes, alignment: 1 bytes
+print-type-size field `.value`: 3077 bytes
+print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]>`: 3077 bytes, alignment: 1 bytes
+print-type-size variant `MaybeUninit`: 3077 bytes
+print-type-size field `.uninit`: 0 bytes
+print-type-size field `.value`: 3077 bytes
+print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]`: 1025 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 1024 bytes
+print-type-size upvar `.arg`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size variant `Returned`: 1024 bytes
+print-type-size upvar `.arg`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size variant `Panicked`: 1024 bytes
+print-type-size upvar `.arg`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]>`: 1025 bytes, alignment: 1 bytes
+print-type-size field `.value`: 1025 bytes
+print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]>`: 1025 bytes, alignment: 1 bytes
+print-type-size variant `MaybeUninit`: 1025 bytes
+print-type-size field `.uninit`: 0 bytes
+print-type-size field `.value`: 1025 bytes
+print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:6:17: 6:19]`: 1 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 0 bytes
+print-type-size variant `Returned`: 0 bytes
+print-type-size variant `Panicked`: 0 bytes
+print-type-size type: `std::mem::ManuallyDrop<bool>`: 1 bytes, alignment: 1 bytes
+print-type-size field `.value`: 1 bytes
+print-type-size type: `std::mem::MaybeUninit<bool>`: 1 bytes, alignment: 1 bytes
+print-type-size variant `MaybeUninit`: 1 bytes
+print-type-size field `.uninit`: 0 bytes
+print-type-size field `.value`: 1 bytes
+print-type-size type: `std::task::Poll<()>`: 1 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Ready`: 0 bytes
+print-type-size field `.0`: 0 bytes
+print-type-size variant `Pending`: 0 bytes
diff --git a/tests/ui/async-await/future-sizes/future-as-arg.rs b/tests/ui/async-await/future-sizes/future-as-arg.rs
new file mode 100644
index 000000000..93c69b052
--- /dev/null
+++ b/tests/ui/async-await/future-sizes/future-as-arg.rs
@@ -0,0 +1,16 @@
+// edition: 2021
+// run-pass
+
+async fn test(_arg: [u8; 16]) {}
+
+async fn use_future(fut: impl std::future::Future<Output = ()>) {
+ fut.await
+}
+
+fn main() {
+ let actual = std::mem::size_of_val(
+ &use_future(use_future(use_future(use_future(use_future(test([0; 16])))))));
+ // Not using an exact number in case it slightly changes over different commits
+ let expected = 550;
+ assert!(actual > expected, "expected: >{expected}, actual: {actual}");
+}
diff --git a/tests/ui/async-await/future-sizes/large-arg.rs b/tests/ui/async-await/future-sizes/large-arg.rs
new file mode 100644
index 000000000..7e7ff9d8d
--- /dev/null
+++ b/tests/ui/async-await/future-sizes/large-arg.rs
@@ -0,0 +1,18 @@
+// compile-flags: -Z print-type-sizes --crate-type=lib
+// edition: 2021
+// build-pass
+// ignore-pass
+
+pub async fn test() {
+ let _ = a([0u8; 1024]).await;
+}
+
+pub async fn a<T>(t: T) -> T {
+ b(t).await
+}
+async fn b<T>(t: T) -> T {
+ c(t).await
+}
+async fn c<T>(t: T) -> T {
+ t
+}
diff --git a/tests/ui/async-await/future-sizes/large-arg.stdout b/tests/ui/async-await/future-sizes/large-arg.stdout
new file mode 100644
index 000000000..91db4b153
--- /dev/null
+++ b/tests/ui/async-await/future-sizes/large-arg.stdout
@@ -0,0 +1,60 @@
+print-type-size type: `[async fn body@$DIR/large-arg.rs:6:21: 8:2]`: 3076 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 0 bytes
+print-type-size variant `Suspend0`: 3075 bytes
+print-type-size local `.__awaitee`: 3075 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size variant `Returned`: 0 bytes
+print-type-size variant `Panicked`: 0 bytes
+print-type-size type: `[async fn body@$DIR/large-arg.rs:10:30: 12:2]`: 3075 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size variant `Suspend0`: 3074 bytes
+print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size local `.__awaitee`: 2050 bytes
+print-type-size variant `Returned`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size variant `Panicked`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:10:30: 12:2]>`: 3075 bytes, alignment: 1 bytes
+print-type-size field `.value`: 3075 bytes
+print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:10:30: 12:2]>`: 3075 bytes, alignment: 1 bytes
+print-type-size variant `MaybeUninit`: 3075 bytes
+print-type-size field `.uninit`: 0 bytes
+print-type-size field `.value`: 3075 bytes
+print-type-size type: `[async fn body@$DIR/large-arg.rs:13:26: 15:2]`: 2050 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size variant `Suspend0`: 2049 bytes
+print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size local `.__awaitee`: 1025 bytes
+print-type-size variant `Returned`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size variant `Panicked`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:13:26: 15:2]>`: 2050 bytes, alignment: 1 bytes
+print-type-size field `.value`: 2050 bytes
+print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:13:26: 15:2]>`: 2050 bytes, alignment: 1 bytes
+print-type-size variant `MaybeUninit`: 2050 bytes
+print-type-size field `.uninit`: 0 bytes
+print-type-size field `.value`: 2050 bytes
+print-type-size type: `[async fn body@$DIR/large-arg.rs:16:26: 18:2]`: 1025 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Unresumed`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size variant `Returned`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size variant `Panicked`: 1024 bytes
+print-type-size upvar `.t`: 1024 bytes, offset: 0 bytes, alignment: 1 bytes
+print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:16:26: 18:2]>`: 1025 bytes, alignment: 1 bytes
+print-type-size field `.value`: 1025 bytes
+print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:16:26: 18:2]>`: 1025 bytes, alignment: 1 bytes
+print-type-size variant `MaybeUninit`: 1025 bytes
+print-type-size field `.uninit`: 0 bytes
+print-type-size field `.value`: 1025 bytes
+print-type-size type: `std::task::Poll<[u8; 1024]>`: 1025 bytes, alignment: 1 bytes
+print-type-size discriminant: 1 bytes
+print-type-size variant `Ready`: 1024 bytes
+print-type-size field `.0`: 1024 bytes
+print-type-size variant `Pending`: 0 bytes
diff --git a/tests/ui/async-await/generator-desc.stderr b/tests/ui/async-await/generator-desc.stderr
index 963c6ba57..51ac9d86b 100644
--- a/tests/ui/async-await/generator-desc.stderr
+++ b/tests/ui/async-await/generator-desc.stderr
@@ -17,22 +17,10 @@ error[E0308]: mismatched types
--> $DIR/generator-desc.rs:12:16
|
LL | fun(one(), two());
- | --- ^^^^^ expected opaque type, found a different opaque type
+ | --- ^^^^^ expected future, found a different future
| |
| arguments to this function are incorrect
|
-note: while checking the return type of the `async fn`
- --> $DIR/generator-desc.rs:5:16
- |
-LL | async fn one() {}
- | ^ checked the `Output` of this `async fn`, expected opaque type
-note: while checking the return type of the `async fn`
- --> $DIR/generator-desc.rs:6:16
- |
-LL | async fn two() {}
- | ^ checked the `Output` of this `async fn`, found opaque type
- = note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:5:16>)
- found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:6:16>)
= help: consider `await`ing on both `Future`s
= note: distinct uses of `impl Trait` result in different opaque types
note: function defined here
diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
new file mode 100644
index 000000000..0fd1a2703
--- /dev/null
+++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
@@ -0,0 +1,66 @@
+// run-pass
+// edition:2021
+
+#![feature(async_fn_in_trait)]
+//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use
+
+use std::future::Future;
+
+trait AsyncTrait {
+ async fn default_impl() {
+ assert!(false);
+ }
+
+ async fn call_default_impl() {
+ Self::default_impl().await
+ }
+}
+
+struct AsyncType;
+
+impl AsyncTrait for AsyncType {
+ async fn default_impl() {
+ // :)
+ }
+}
+
+async fn async_main() {
+ // Should not assert false
+ AsyncType::call_default_impl().await;
+}
+
+// ------------------------------------------------------------------------- //
+// Implementation Details Below...
+
+use std::pin::Pin;
+use std::task::*;
+
+pub fn noop_waker() -> Waker {
+ let raw = RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE);
+
+ // SAFETY: the contracts for RawWaker and RawWakerVTable are upheld
+ unsafe { Waker::from_raw(raw) }
+}
+
+const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop);
+
+unsafe fn noop_clone(_p: *const ()) -> RawWaker {
+ RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE)
+}
+
+unsafe fn noop(_p: *const ()) {}
+
+fn main() {
+ let mut fut = async_main();
+
+ // Poll loop, just to test the future...
+ let waker = noop_waker();
+ let ctx = &mut Context::from_waker(&waker);
+
+ loop {
+ match unsafe { Pin::new_unchecked(&mut fut).poll(ctx) } {
+ Poll::Pending => {}
+ Poll::Ready(()) => break,
+ }
+ }
+}
diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.stderr b/tests/ui/async-await/in-trait/async-default-fn-overridden.stderr
new file mode 100644
index 000000000..61a826258
--- /dev/null
+++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.stderr
@@ -0,0 +1,11 @@
+warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/async-default-fn-overridden.rs:4: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
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr
index 13e722255..168ef8e9e 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr
@@ -2,7 +2,7 @@ error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:15:28
|
LL | async fn foo(&self) -> i32 {
- | ^^^ expected struct `Pin`, found opaque type
+ | ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
|
note: type in trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:11:22
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
new file mode 100644
index 000000000..afd3db5e0
--- /dev/null
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
@@ -0,0 +1,71 @@
+// edition: 2021
+// known-bug: #108309
+
+#![feature(async_fn_in_trait)]
+#![feature(min_specialization)]
+
+struct MyStruct;
+
+trait MyTrait<T> {
+ async fn foo(_: T) -> &'static str;
+}
+
+impl<T> MyTrait<T> for MyStruct {
+ default async fn foo(_: T) -> &'static str {
+ "default"
+ }
+}
+
+impl MyTrait<i32> for MyStruct {
+ async fn foo(_: i32) -> &'static str {
+ "specialized"
+ }
+}
+
+async fn async_main() {
+ assert_eq!(MyStruct::foo(42).await, "specialized");
+ assert_eq!(indirection(42).await, "specialized");
+}
+
+async fn indirection<T>(x: T) -> &'static str {
+ //explicit type coercion is currently necessary
+ // because of https://github.com/rust-lang/rust/issues/67918
+ <MyStruct as MyTrait<T>>::foo(x).await
+}
+
+// ------------------------------------------------------------------------- //
+// Implementation Details Below...
+
+use std::future::Future;
+use std::pin::Pin;
+use std::task::*;
+
+pub fn noop_waker() -> Waker {
+ let raw = RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE);
+
+ // SAFETY: the contracts for RawWaker and RawWakerVTable are upheld
+ unsafe { Waker::from_raw(raw) }
+}
+
+const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop);
+
+unsafe fn noop_clone(_p: *const ()) -> RawWaker {
+ RawWaker::new(std::ptr::null(), &NOOP_WAKER_VTABLE)
+}
+
+unsafe fn noop(_p: *const ()) {}
+
+fn main() {
+ let mut fut = async_main();
+
+ // Poll loop, just to test the future...
+ let waker = noop_waker();
+ let ctx = &mut Context::from_waker(&waker);
+
+ loop {
+ match unsafe { Pin::new_unchecked(&mut fut).poll(ctx) } {
+ Poll::Pending => {}
+ Poll::Ready(()) => break,
+ }
+ }
+}
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr
new file mode 100644
index 000000000..f71fd9980
--- /dev/null
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr
@@ -0,0 +1,19 @@
+warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/dont-project-to-specializable-projection.rs:4: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: async associated function in trait cannot be specialized
+ --> $DIR/dont-project-to-specializable-projection.rs:14:5
+ |
+LL | default async fn foo(_: T) -> &'static str {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: specialization behaves in inconsistent and surprising ways with `#![feature(async_fn_in_trait)]`, and for now is disallowed
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.rs b/tests/ui/async-await/in-trait/fn-not-async-err2.rs
index 2c4ed5535..78017429f 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err2.rs
+++ b/tests/ui/async-await/in-trait/fn-not-async-err2.rs
@@ -11,7 +11,7 @@ trait MyTrait {
impl MyTrait for i32 {
fn foo(&self) -> impl Future<Output = i32> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `impl` method return [E0562]
+ //~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
async { *self }
}
}
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.stderr b/tests/ui/async-await/in-trait/fn-not-async-err2.stderr
index f591f1847..37d9669c0 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err2.stderr
+++ b/tests/ui/async-await/in-trait/fn-not-async-err2.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return
+error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
--> $DIR/fn-not-async-err2.rs:13:22
|
LL | fn foo(&self) -> impl Future<Output = i32> {
diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.stderr b/tests/ui/async-await/in-trait/return-type-suggestion.stderr
index 5a9b15e54..b8d83d0f2 100644
--- a/tests/ui/async-await/in-trait/return-type-suggestion.stderr
+++ b/tests/ui/async-await/in-trait/return-type-suggestion.stderr
@@ -13,7 +13,7 @@ error[E0308]: mismatched types
LL | Ok(())
| ^^^^^^- help: consider using a semicolon here: `;`
| |
- | expected `()`, found enum `Result`
+ | expected `()`, found `Result<(), _>`
|
= note: expected unit type `()`
found enum `Result<(), _>`
diff --git a/tests/ui/async-await/issue-61076.rs b/tests/ui/async-await/issue-61076.rs
index 750fad839..cf6e5b4e4 100644
--- a/tests/ui/async-await/issue-61076.rs
+++ b/tests/ui/async-await/issue-61076.rs
@@ -54,9 +54,6 @@ async fn struct_() -> Struct {
}
async fn tuple() -> Tuple {
- //~^ NOTE checked the `Output` of this `async fn`, expected opaque type
- //~| NOTE while checking the return type of the `async fn`
- //~| NOTE in this expansion of desugaring of `async` block or function
Tuple(1i32)
}
@@ -89,7 +86,7 @@ async fn match_() {
match tuple() { //~ HELP consider `await`ing on the `Future`
//~^ NOTE this expression has type `impl Future<Output = Tuple>`
Tuple(_) => {} //~ ERROR mismatched types
- //~^ NOTE expected opaque type, found struct `Tuple`
+ //~^ NOTE expected future, found `Tuple`
//~| NOTE expected opaque type `impl Future<Output = Tuple>`
}
}
diff --git a/tests/ui/async-await/issue-61076.stderr b/tests/ui/async-await/issue-61076.stderr
index 33839ea59..44de28298 100644
--- a/tests/ui/async-await/issue-61076.stderr
+++ b/tests/ui/async-await/issue-61076.stderr
@@ -11,7 +11,7 @@ LL | foo().await?;
| ++++++
error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/issue-61076.rs:65:5
+ --> $DIR/issue-61076.rs:62:5
|
LL | t?;
| ^^ the `?` operator cannot be applied to type `T`
@@ -23,7 +23,7 @@ LL | t.await?;
| ++++++
error[E0609]: no field `0` on type `impl Future<Output = Tuple>`
- --> $DIR/issue-61076.rs:74:26
+ --> $DIR/issue-61076.rs:71:26
|
LL | let _: i32 = tuple().0;
| ^ field not available in `impl Future`, but it is available in its `Output`
@@ -34,7 +34,7 @@ LL | let _: i32 = tuple().await.0;
| ++++++
error[E0609]: no field `a` on type `impl Future<Output = Struct>`
- --> $DIR/issue-61076.rs:78:28
+ --> $DIR/issue-61076.rs:75:28
|
LL | let _: i32 = struct_().a;
| ^ field not available in `impl Future`, but it is available in its `Output`
@@ -45,7 +45,7 @@ LL | let _: i32 = struct_().await.a;
| ++++++
error[E0599]: no method named `method` found for opaque type `impl Future<Output = Struct>` in the current scope
- --> $DIR/issue-61076.rs:82:15
+ --> $DIR/issue-61076.rs:79:15
|
LL | struct_().method();
| ^^^^^^ method not found in `impl Future<Output = Struct>`
@@ -56,19 +56,14 @@ LL | struct_().await.method();
| ++++++
error[E0308]: mismatched types
- --> $DIR/issue-61076.rs:91:9
+ --> $DIR/issue-61076.rs:88:9
|
LL | match tuple() {
| ------- this expression has type `impl Future<Output = Tuple>`
LL |
LL | Tuple(_) => {}
- | ^^^^^^^^ expected opaque type, found struct `Tuple`
+ | ^^^^^^^^ expected future, found `Tuple`
|
-note: while checking the return type of the `async fn`
- --> $DIR/issue-61076.rs:56:21
- |
-LL | async fn tuple() -> Tuple {
- | ^^^^^ checked the `Output` of this `async fn`, expected opaque type
= note: expected opaque type `impl Future<Output = Tuple>`
found struct `Tuple`
help: consider `await`ing on the `Future`
diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr
new file mode 100644
index 000000000..c4c7f26c7
--- /dev/null
+++ b/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr
@@ -0,0 +1,25 @@
+error: future cannot be shared between threads safely
+ --> $DIR/issue-64130-1-sync.rs:25:13
+ |
+LL | is_sync(bar());
+ | ^^^^^ future returned by `bar` is not `Sync`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
+note: future is not `Sync` as this value is used across an await
+ --> $DIR/issue-64130-1-sync.rs:18:10
+ |
+LL | let x = Foo;
+ | - has type `Foo` which is not `Sync`
+LL | baz().await;
+ | ^^^^^^ await occurs here, with `x` maybe used later
+LL | drop(x);
+LL | }
+ | - `x` is later dropped here
+note: required by a bound in `is_sync`
+ --> $DIR/issue-64130-1-sync.rs:14:15
+ |
+LL | fn is_sync<T: Sync>(t: T) { }
+ | ^^^^ required by this bound in `is_sync`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr
new file mode 100644
index 000000000..6f43b568a
--- /dev/null
+++ b/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr
@@ -0,0 +1,22 @@
+error: future cannot be shared between threads safely
+ --> $DIR/issue-64130-1-sync.rs:25:13
+ |
+LL | is_sync(bar());
+ | ^^^^^ future returned by `bar` is not `Sync`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
+note: future is not `Sync` as this value is used across an await
+ --> $DIR/issue-64130-1-sync.rs:18:10
+ |
+LL | let x = Foo;
+ | - has type `Foo` which is not `Sync`
+LL | baz().await;
+ | ^^^^^^ await occurs here, with `x` maybe used later
+note: required by a bound in `is_sync`
+ --> $DIR/issue-64130-1-sync.rs:14:15
+ |
+LL | fn is_sync<T: Sync>(t: T) { }
+ | ^^^^ required by this bound in `is_sync`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr
new file mode 100644
index 000000000..c4c7f26c7
--- /dev/null
+++ b/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr
@@ -0,0 +1,25 @@
+error: future cannot be shared between threads safely
+ --> $DIR/issue-64130-1-sync.rs:25:13
+ |
+LL | is_sync(bar());
+ | ^^^^^ future returned by `bar` is not `Sync`
+ |
+ = help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
+note: future is not `Sync` as this value is used across an await
+ --> $DIR/issue-64130-1-sync.rs:18:10
+ |
+LL | let x = Foo;
+ | - has type `Foo` which is not `Sync`
+LL | baz().await;
+ | ^^^^^^ await occurs here, with `x` maybe used later
+LL | drop(x);
+LL | }
+ | - `x` is later dropped here
+note: required by a bound in `is_sync`
+ --> $DIR/issue-64130-1-sync.rs:14:15
+ |
+LL | fn is_sync<T: Sync>(t: T) { }
+ | ^^^^ required by this bound in `is_sync`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-64130-1-sync.rs b/tests/ui/async-await/issue-64130-1-sync.rs
index 1714cec52..44646e0e5 100644
--- a/tests/ui/async-await/issue-64130-1-sync.rs
+++ b/tests/ui/async-await/issue-64130-1-sync.rs
@@ -1,3 +1,6 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(negative_impls)]
// edition:2018
@@ -13,6 +16,7 @@ fn is_sync<T: Sync>(t: T) { }
async fn bar() {
let x = Foo;
baz().await;
+ drop(x);
}
async fn baz() { }
diff --git a/tests/ui/async-await/issue-64130-1-sync.stderr b/tests/ui/async-await/issue-64130-1-sync.stderr
index e205de473..8d5169a63 100644
--- a/tests/ui/async-await/issue-64130-1-sync.stderr
+++ b/tests/ui/async-await/issue-64130-1-sync.stderr
@@ -1,12 +1,12 @@
error: future cannot be shared between threads safely
- --> $DIR/issue-64130-1-sync.rs:21:13
+ --> $DIR/issue-64130-1-sync.rs:24:13
|
LL | is_sync(bar());
| ^^^^^ future returned by `bar` is not `Sync`
|
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
note: future is not `Sync` as this value is used across an await
- --> $DIR/issue-64130-1-sync.rs:15:10
+ --> $DIR/issue-64130-1-sync.rs:18:10
|
LL | let x = Foo;
| - has type `Foo` which is not `Sync`
@@ -15,7 +15,7 @@ LL | baz().await;
LL | }
| - `x` is later dropped here
note: required by a bound in `is_sync`
- --> $DIR/issue-64130-1-sync.rs:11:15
+ --> $DIR/issue-64130-1-sync.rs:14:15
|
LL | fn is_sync<T: Sync>(t: T) { }
| ^^^^ required by this bound in `is_sync`
diff --git a/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr b/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr
new file mode 100644
index 000000000..b6a73c2a5
--- /dev/null
+++ b/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr
@@ -0,0 +1,28 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-64130-2-send.rs:24:13
+ |
+LL | is_send(bar());
+ | ^^^^^ future returned by `bar` is not `Send`
+ |
+ = note: the trait bound `Unique<Foo>: Send` is not satisfied
+note: future is not `Send` as this value is used across an await
+ --> $DIR/issue-64130-2-send.rs:18:10
+ |
+LL | let x = Box::new(Foo);
+ | - has type `Box<Foo>` which is not `Send`
+LL | baz().await;
+ | ^^^^^^ await occurs here, with `x` maybe used later
+LL | }
+ | - `x` is later dropped here
+note: required by a bound in `is_send`
+ --> $DIR/issue-64130-2-send.rs:14:15
+ |
+LL | fn is_send<T: Send>(t: T) { }
+ | ^^^^ required by this bound in `is_send`
+help: consider borrowing here
+ |
+LL | is_send(&bar());
+ | +
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr
new file mode 100644
index 000000000..560560f60
--- /dev/null
+++ b/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr
@@ -0,0 +1,26 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-64130-2-send.rs:24:13
+ |
+LL | is_send(bar());
+ | ^^^^^ future returned by `bar` is not `Send`
+ |
+ = note: the trait bound `Unique<Foo>: Send` is not satisfied
+note: future is not `Send` as this value is used across an await
+ --> $DIR/issue-64130-2-send.rs:18:10
+ |
+LL | let x = Box::new(Foo);
+ | - has type `Box<Foo>` which is not `Send`
+LL | baz().await;
+ | ^^^^^^ await occurs here, with `x` maybe used later
+note: required by a bound in `is_send`
+ --> $DIR/issue-64130-2-send.rs:14:15
+ |
+LL | fn is_send<T: Send>(t: T) { }
+ | ^^^^ required by this bound in `is_send`
+help: consider borrowing here
+ |
+LL | is_send(&bar());
+ | +
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr
new file mode 100644
index 000000000..b6a73c2a5
--- /dev/null
+++ b/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr
@@ -0,0 +1,28 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-64130-2-send.rs:24:13
+ |
+LL | is_send(bar());
+ | ^^^^^ future returned by `bar` is not `Send`
+ |
+ = note: the trait bound `Unique<Foo>: Send` is not satisfied
+note: future is not `Send` as this value is used across an await
+ --> $DIR/issue-64130-2-send.rs:18:10
+ |
+LL | let x = Box::new(Foo);
+ | - has type `Box<Foo>` which is not `Send`
+LL | baz().await;
+ | ^^^^^^ await occurs here, with `x` maybe used later
+LL | }
+ | - `x` is later dropped here
+note: required by a bound in `is_send`
+ --> $DIR/issue-64130-2-send.rs:14:15
+ |
+LL | fn is_send<T: Send>(t: T) { }
+ | ^^^^ required by this bound in `is_send`
+help: consider borrowing here
+ |
+LL | is_send(&bar());
+ | +
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-64130-2-send.rs b/tests/ui/async-await/issue-64130-2-send.rs
index 7a6e5952c..d6d855bac 100644
--- a/tests/ui/async-await/issue-64130-2-send.rs
+++ b/tests/ui/async-await/issue-64130-2-send.rs
@@ -1,3 +1,6 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(negative_impls)]
// edition:2018
@@ -11,7 +14,7 @@ impl !Send for Foo {}
fn is_send<T: Send>(t: T) { }
async fn bar() {
- let x = Foo;
+ let x = Box::new(Foo);
baz().await;
}
diff --git a/tests/ui/async-await/issue-64130-2-send.stderr b/tests/ui/async-await/issue-64130-2-send.stderr
index 2225000e2..f6505cad6 100644
--- a/tests/ui/async-await/issue-64130-2-send.stderr
+++ b/tests/ui/async-await/issue-64130-2-send.stderr
@@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-64130-2-send.rs:21:13
+ --> $DIR/issue-64130-2-send.rs:24:13
|
LL | is_send(bar());
| ^^^^^ future returned by `bar` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-2-send.rs:15:10
+ --> $DIR/issue-64130-2-send.rs:18:10
|
LL | let x = Foo;
| - has type `Foo` which is not `Send`
@@ -15,7 +15,7 @@ LL | baz().await;
LL | }
| - `x` is later dropped here
note: required by a bound in `is_send`
- --> $DIR/issue-64130-2-send.rs:11:15
+ --> $DIR/issue-64130-2-send.rs:14:15
|
LL | fn is_send<T: Send>(t: T) { }
| ^^^^ required by this bound in `is_send`
diff --git a/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr b/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr
new file mode 100644
index 000000000..d65aae8cc
--- /dev/null
+++ b/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr
@@ -0,0 +1,27 @@
+error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
+ --> $DIR/issue-64130-3-other.rs:27:12
+ |
+LL | async fn bar() {
+ | - within this `impl Future<Output = ()>`
+...
+LL | is_qux(bar());
+ | ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
+ |
+note: future does not implement `Qux` as this value is used across an await
+ --> $DIR/issue-64130-3-other.rs:21:10
+ |
+LL | let x = Box::new(Foo);
+ | - has type `Box<Foo>` which does not implement `Qux`
+LL | baz().await;
+ | ^^^^^^ await occurs here, with `x` maybe used later
+LL | }
+ | - `x` is later dropped here
+note: required by a bound in `is_qux`
+ --> $DIR/issue-64130-3-other.rs:17:14
+ |
+LL | fn is_qux<T: Qux>(t: T) {}
+ | ^^^ required by this bound in `is_qux`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr
new file mode 100644
index 000000000..8fed69d9d
--- /dev/null
+++ b/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr
@@ -0,0 +1,25 @@
+error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
+ --> $DIR/issue-64130-3-other.rs:27:12
+ |
+LL | async fn bar() {
+ | - within this `impl Future<Output = ()>`
+...
+LL | is_qux(bar());
+ | ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
+ |
+note: future does not implement `Qux` as this value is used across an await
+ --> $DIR/issue-64130-3-other.rs:21:10
+ |
+LL | let x = Box::new(Foo);
+ | - has type `Box<Foo>` which does not implement `Qux`
+LL | baz().await;
+ | ^^^^^^ await occurs here, with `x` maybe used later
+note: required by a bound in `is_qux`
+ --> $DIR/issue-64130-3-other.rs:17:14
+ |
+LL | fn is_qux<T: Qux>(t: T) {}
+ | ^^^ required by this bound in `is_qux`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr
new file mode 100644
index 000000000..d65aae8cc
--- /dev/null
+++ b/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr
@@ -0,0 +1,27 @@
+error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
+ --> $DIR/issue-64130-3-other.rs:27:12
+ |
+LL | async fn bar() {
+ | - within this `impl Future<Output = ()>`
+...
+LL | is_qux(bar());
+ | ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
+ |
+note: future does not implement `Qux` as this value is used across an await
+ --> $DIR/issue-64130-3-other.rs:21:10
+ |
+LL | let x = Box::new(Foo);
+ | - has type `Box<Foo>` which does not implement `Qux`
+LL | baz().await;
+ | ^^^^^^ await occurs here, with `x` maybe used later
+LL | }
+ | - `x` is later dropped here
+note: required by a bound in `is_qux`
+ --> $DIR/issue-64130-3-other.rs:17:14
+ |
+LL | fn is_qux<T: Qux>(t: T) {}
+ | ^^^ required by this bound in `is_qux`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-64130-3-other.rs b/tests/ui/async-await/issue-64130-3-other.rs
index 630fb2c41..92d3b7c81 100644
--- a/tests/ui/async-await/issue-64130-3-other.rs
+++ b/tests/ui/async-await/issue-64130-3-other.rs
@@ -1,3 +1,6 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(auto_traits)]
#![feature(negative_impls)]
// edition:2018
@@ -14,7 +17,7 @@ impl !Qux for Foo {}
fn is_qux<T: Qux>(t: T) {}
async fn bar() {
- let x = Foo;
+ let x = Box::new(Foo);
baz().await;
}
diff --git a/tests/ui/async-await/issue-64130-3-other.stderr b/tests/ui/async-await/issue-64130-3-other.stderr
index 17867a6a3..cb36a3811 100644
--- a/tests/ui/async-await/issue-64130-3-other.stderr
+++ b/tests/ui/async-await/issue-64130-3-other.stderr
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
- --> $DIR/issue-64130-3-other.rs:24:12
+ --> $DIR/issue-64130-3-other.rs:27:12
|
LL | async fn bar() {
| - within this `impl Future<Output = ()>`
@@ -8,7 +8,7 @@ LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
|
note: future does not implement `Qux` as this value is used across an await
- --> $DIR/issue-64130-3-other.rs:18:10
+ --> $DIR/issue-64130-3-other.rs:21:10
|
LL | let x = Foo;
| - has type `Foo` which does not implement `Qux`
@@ -17,7 +17,7 @@ LL | baz().await;
LL | }
| - `x` is later dropped here
note: required by a bound in `is_qux`
- --> $DIR/issue-64130-3-other.rs:14:14
+ --> $DIR/issue-64130-3-other.rs:17:14
|
LL | fn is_qux<T: Qux>(t: T) {}
| ^^^ required by this bound in `is_qux`
diff --git a/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr b/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr
index f609e3636..884619f4d 100644
--- a/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr
+++ b/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr
@@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-64130-4-async-move.rs:19:17
+ --> $DIR/issue-64130-4-async-move.rs:20:17
|
LL | pub fn foo() -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-4-async-move.rs:25:31
+ --> $DIR/issue-64130-4-async-move.rs:27:31
|
LL | match client.status() {
| ------ has type `&Client` which is not `Send`
@@ -17,7 +17,7 @@ LL | let _x = get().await;
LL | }
| - `client` is later dropped here
help: consider moving this into a `let` binding to create a shorter lived borrow
- --> $DIR/issue-64130-4-async-move.rs:23:15
+ --> $DIR/issue-64130-4-async-move.rs:25:15
|
LL | match client.status() {
| ^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
index f609e3636..0bc7cb2f2 100644
--- a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
+++ b/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
@@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-64130-4-async-move.rs:19:17
+ --> $DIR/issue-64130-4-async-move.rs:21:17
|
LL | pub fn foo() -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-4-async-move.rs:25:31
+ --> $DIR/issue-64130-4-async-move.rs:27:31
|
LL | match client.status() {
| ------ has type `&Client` which is not `Send`
@@ -17,7 +17,7 @@ LL | let _x = get().await;
LL | }
| - `client` is later dropped here
help: consider moving this into a `let` binding to create a shorter lived borrow
- --> $DIR/issue-64130-4-async-move.rs:23:15
+ --> $DIR/issue-64130-4-async-move.rs:25:15
|
LL | match client.status() {
| ^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/issue-64130-4-async-move.rs b/tests/ui/async-await/issue-64130-4-async-move.rs
index a38428fc0..bcb297aaa 100644
--- a/tests/ui/async-await/issue-64130-4-async-move.rs
+++ b/tests/ui/async-await/issue-64130-4-async-move.rs
@@ -1,8 +1,10 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
+// [drop_tracking_mir] check-pass
// [drop_tracking] check-pass
-// [drop_tracking] compile-flags: -Zdrop-tracking=yes
-// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
+
use std::any::Any;
use std::future::Future;
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr
new file mode 100644
index 000000000..fc8bcc8ae
--- /dev/null
+++ b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr
@@ -0,0 +1,30 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-67252-unnamed-future.rs:21:11
+ |
+LL | spawn(async {
+ | ___________^
+LL | | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
+LL | | AFuture.await;
+LL | | drop(a);
+LL | | });
+ | |_____^ future created by async block is not `Send`
+ |
+ = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/issue-67252-unnamed-future.rs:23:16
+ |
+LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
+ | - has type `*mut ()` which is not `Send`
+LL | AFuture.await;
+ | ^^^^^^ await occurs here, with `a` maybe used later
+LL | drop(a);
+LL | });
+ | - `a` is later dropped here
+note: required by a bound in `spawn`
+ --> $DIR/issue-67252-unnamed-future.rs:9:13
+ |
+LL | fn spawn<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `spawn`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr
new file mode 100644
index 000000000..a3ef7add1
--- /dev/null
+++ b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr
@@ -0,0 +1,22 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-67252-unnamed-future.rs:21:5
+ |
+LL | spawn(async {
+ | ^^^^^ future created by async block is not `Send`
+ |
+ = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/issue-67252-unnamed-future.rs:23:16
+ |
+LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
+ | - has type `*mut ()` which is not `Send`
+LL | AFuture.await;
+ | ^^^^^^ await occurs here, with `a` maybe used later
+note: required by a bound in `spawn`
+ --> $DIR/issue-67252-unnamed-future.rs:9:13
+ |
+LL | fn spawn<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `spawn`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr
new file mode 100644
index 000000000..fc8bcc8ae
--- /dev/null
+++ b/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr
@@ -0,0 +1,30 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-67252-unnamed-future.rs:21:11
+ |
+LL | spawn(async {
+ | ___________^
+LL | | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
+LL | | AFuture.await;
+LL | | drop(a);
+LL | | });
+ | |_____^ future created by async block is not `Send`
+ |
+ = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/issue-67252-unnamed-future.rs:23:16
+ |
+LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
+ | - has type `*mut ()` which is not `Send`
+LL | AFuture.await;
+ | ^^^^^^ await occurs here, with `a` maybe used later
+LL | drop(a);
+LL | });
+ | - `a` is later dropped here
+note: required by a bound in `spawn`
+ --> $DIR/issue-67252-unnamed-future.rs:9:13
+ |
+LL | fn spawn<T: Send>(_: T) {}
+ | ^^^^ required by this bound in `spawn`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.rs b/tests/ui/async-await/issue-67252-unnamed-future.rs
index 1a7ff6133..bb9ad77ce 100644
--- a/tests/ui/async-await/issue-67252-unnamed-future.rs
+++ b/tests/ui/async-await/issue-67252-unnamed-future.rs
@@ -1,3 +1,6 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
use std::future::Future;
use std::pin::Pin;
@@ -16,8 +19,9 @@ impl Future for AFuture{
async fn foo() {
spawn(async { //~ ERROR future cannot be sent between threads safely
- let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
+ let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
AFuture.await;
+ drop(a);
});
}
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.stderr b/tests/ui/async-await/issue-67252-unnamed-future.stderr
deleted file mode 100644
index fcba4410b..000000000
--- a/tests/ui/async-await/issue-67252-unnamed-future.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-67252-unnamed-future.rs:18:11
- |
-LL | spawn(async {
- | ___________^
-LL | | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
-LL | | AFuture.await;
-LL | | });
- | |_____^ future created by async block is not `Send`
- |
- = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:18:11: 21:6]`, the trait `Send` is not implemented for `*mut ()`
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-67252-unnamed-future.rs:20:16
- |
-LL | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
- | -- has type `*mut ()` which is not `Send`
-LL | AFuture.await;
- | ^^^^^^ await occurs here, with `_a` maybe used later
-LL | });
- | - `_a` is later dropped here
-note: required by a bound in `spawn`
- --> $DIR/issue-67252-unnamed-future.rs:6:13
- |
-LL | fn spawn<T: Send>(_: T) {}
- | ^^^^ required by this bound in `spawn`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-68112.drop_tracking.stderr b/tests/ui/async-await/issue-68112.drop_tracking.stderr
index f2802698f..bd648de30 100644
--- a/tests/ui/async-await/issue-68112.drop_tracking.stderr
+++ b/tests/ui/async-await/issue-68112.drop_tracking.stderr
@@ -5,6 +5,7 @@ LL | require_send(send_fut);
| ^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/issue-68112.rs:34:17
|
@@ -23,6 +24,7 @@ LL | require_send(send_fut);
| ^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/issue-68112.rs:43:17
|
@@ -43,6 +45,7 @@ LL | require_send(send_fut);
| required by a bound introduced by this call
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
note: required because it's used within this `async fn` body
--> $DIR/issue-68112.rs:50:31
diff --git a/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr b/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr
new file mode 100644
index 000000000..7a9242cba
--- /dev/null
+++ b/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr
@@ -0,0 +1,80 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-68112.rs:37:5
+ |
+LL | require_send(send_fut);
+ | ^^^^^^^^^^^^ future created by async block is not `Send`
+ |
+ = help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
+note: future is not `Send` as it awaits another future which is not `Send`
+ --> $DIR/issue-68112.rs:34:17
+ |
+LL | let _ = non_send_fut.await;
+ | ^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
+note: required by a bound in `require_send`
+ --> $DIR/issue-68112.rs:14:25
+ |
+LL | fn require_send(_: impl Send) {}
+ | ^^^^ required by this bound in `require_send`
+
+error: future cannot be sent between threads safely
+ --> $DIR/issue-68112.rs:46:5
+ |
+LL | require_send(send_fut);
+ | ^^^^^^^^^^^^ future created by async block is not `Send`
+ |
+ = help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
+note: future is not `Send` as it awaits another future which is not `Send`
+ --> $DIR/issue-68112.rs:43:17
+ |
+LL | let _ = make_non_send_future1().await;
+ | ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
+note: required by a bound in `require_send`
+ --> $DIR/issue-68112.rs:14:25
+ |
+LL | fn require_send(_: impl Send) {}
+ | ^^^^ required by this bound in `require_send`
+
+error[E0277]: `RefCell<i32>` cannot be shared between threads safely
+ --> $DIR/issue-68112.rs:65:5
+ |
+LL | require_send(send_fut);
+ | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
+ |
+ = help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
+ = note: required for `Arc<RefCell<i32>>` to implement `Send`
+note: required because it's used within this `async fn` body
+ --> $DIR/issue-68112.rs:50:31
+ |
+LL | async fn ready2<T>(t: T) -> T {
+ | _______________________________^
+LL | | t
+LL | | }
+ | |_^
+note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
+ --> $DIR/issue-68112.rs:53:31
+ |
+LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: required because it captures the following types: `impl Future<Output = Arc<RefCell<i32>>>`, `Ready<i32>`
+note: required because it's used within this `async` block
+ --> $DIR/issue-68112.rs:60:20
+ |
+LL | let send_fut = async {
+ | ____________________^
+LL | | let non_send_fut = make_non_send_future2();
+LL | | let _ = non_send_fut.await;
+LL | | ready(0).await;
+LL | | };
+ | |_____^
+note: required by a bound in `require_send`
+ --> $DIR/issue-68112.rs:14:25
+ |
+LL | fn require_send(_: impl Send) {}
+ | ^^^^ required by this bound in `require_send`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-68112.no_drop_tracking.stderr b/tests/ui/async-await/issue-68112.no_drop_tracking.stderr
index 38eb85b30..35b7341f6 100644
--- a/tests/ui/async-await/issue-68112.no_drop_tracking.stderr
+++ b/tests/ui/async-await/issue-68112.no_drop_tracking.stderr
@@ -5,6 +5,7 @@ LL | require_send(send_fut);
| ^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/issue-68112.rs:34:17
|
@@ -23,6 +24,7 @@ LL | require_send(send_fut);
| ^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
note: future is not `Send` as it awaits another future which is not `Send`
--> $DIR/issue-68112.rs:43:17
|
@@ -43,6 +45,7 @@ LL | require_send(send_fut);
| required by a bound introduced by this call
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
+ = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
note: required because it's used within this `async fn` body
--> $DIR/issue-68112.rs:50:31
diff --git a/tests/ui/async-await/issue-68112.rs b/tests/ui/async-await/issue-68112.rs
index 9c705137a..19119ae0f 100644
--- a/tests/ui/async-await/issue-68112.rs
+++ b/tests/ui/async-await/issue-68112.rs
@@ -1,7 +1,7 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking
-// [drop_tracking] compile-flags: -Zdrop-tracking=yes
-// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
use std::{
cell::RefCell,
@@ -14,7 +14,7 @@ use std::{
fn require_send(_: impl Send) {}
struct Ready<T>(Option<T>);
-impl<T> Future for Ready<T> {
+impl<T: Unpin> Future for Ready<T> {
type Output = T;
fn poll(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<T> {
Poll::Ready(self.0.take().unwrap())
diff --git a/tests/ui/async-await/issue-70818.drop_tracking.stderr b/tests/ui/async-await/issue-70818.drop_tracking.stderr
new file mode 100644
index 000000000..ab0698c3e
--- /dev/null
+++ b/tests/ui/async-await/issue-70818.drop_tracking.stderr
@@ -0,0 +1,18 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-70818.rs:7:38
+ |
+LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
+ |
+note: captured value is not `Send`
+ --> $DIR/issue-70818.rs:9:18
+ |
+LL | async { (ty, ty1) }
+ | ^^^ has type `U` which is not `Send`
+help: consider restricting type parameter `U`
+ |
+LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
+ | +++++++++++++++++++
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr b/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr
new file mode 100644
index 000000000..ab0698c3e
--- /dev/null
+++ b/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr
@@ -0,0 +1,18 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-70818.rs:7:38
+ |
+LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
+ |
+note: captured value is not `Send`
+ --> $DIR/issue-70818.rs:9:18
+ |
+LL | async { (ty, ty1) }
+ | ^^^ has type `U` which is not `Send`
+help: consider restricting type parameter `U`
+ |
+LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
+ | +++++++++++++++++++
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-70818.no_drop_tracking.stderr b/tests/ui/async-await/issue-70818.no_drop_tracking.stderr
new file mode 100644
index 000000000..ab0698c3e
--- /dev/null
+++ b/tests/ui/async-await/issue-70818.no_drop_tracking.stderr
@@ -0,0 +1,18 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-70818.rs:7:38
+ |
+LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
+ |
+note: captured value is not `Send`
+ --> $DIR/issue-70818.rs:9:18
+ |
+LL | async { (ty, ty1) }
+ | ^^^ has type `U` which is not `Send`
+help: consider restricting type parameter `U`
+ |
+LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
+ | +++++++++++++++++++
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-70818.rs b/tests/ui/async-await/issue-70818.rs
index 019c56eb2..2941de0f5 100644
--- a/tests/ui/async-await/issue-70818.rs
+++ b/tests/ui/async-await/issue-70818.rs
@@ -1,3 +1,6 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
use std::future::Future;
diff --git a/tests/ui/async-await/issue-70818.stderr b/tests/ui/async-await/issue-70818.stderr
index 20109d4d1..ab0698c3e 100644
--- a/tests/ui/async-await/issue-70818.stderr
+++ b/tests/ui/async-await/issue-70818.stderr
@@ -1,11 +1,11 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-70818.rs:4:38
+ --> $DIR/issue-70818.rs:7:38
|
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
note: captured value is not `Send`
- --> $DIR/issue-70818.rs:6:18
+ --> $DIR/issue-70818.rs:9:18
|
LL | async { (ty, ty1) }
| ^^^ has type `U` which is not `Send`
diff --git a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr b/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr
new file mode 100644
index 000000000..c636be15a
--- /dev/null
+++ b/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr
@@ -0,0 +1,34 @@
+error[E0277]: `Sender<i32>` cannot be shared between threads safely
+ --> $DIR/issue-70935-complex-spans.rs:13:45
+ |
+LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
+ | ^^^^^^^^^^^^^^^^^^ `Sender<i32>` cannot be shared between threads safely
+ |
+ = help: the trait `Sync` is not implemented for `Sender<i32>`
+ = note: required for `&Sender<i32>` to implement `Send`
+note: required because it's used within this closure
+ --> $DIR/issue-70935-complex-spans.rs:17:13
+ |
+LL | baz(|| async{
+ | ^^
+note: required because it's used within this `async fn` body
+ --> $DIR/issue-70935-complex-spans.rs:10:67
+ |
+LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
+ | ___________________________________________________________________^
+LL | | }
+ | |_^
+ = note: required because it captures the following types: `impl Future<Output = ()>`
+note: required because it's used within this `async` block
+ --> $DIR/issue-70935-complex-spans.rs:16:5
+ |
+LL | / async move {
+LL | | baz(|| async{
+LL | | foo(tx.clone());
+LL | | }).await;
+LL | | }
+ | |_____^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-70935-complex-spans.rs b/tests/ui/async-await/issue-70935-complex-spans.rs
index b6d17f93a..78625bd39 100644
--- a/tests/ui/async-await/issue-70935-complex-spans.rs
+++ b/tests/ui/async-await/issue-70935-complex-spans.rs
@@ -1,7 +1,7 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking
-// [no_drop_tracking]compile-flags:-Zdrop-tracking=no
-// [drop_tracking]compile-flags:-Zdrop-tracking
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// #70935: Check if we do not emit snippet
// with newlines which lead complex diagnostics.
@@ -12,7 +12,7 @@ async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
- //[drop_tracking]~^^ ERROR `Sender<i32>` cannot be shared between threads
+ //[drop_tracking,drop_tracking_mir]~^^ ERROR `Sender<i32>` cannot be shared between threads
async move {
baz(|| async{
foo(tx.clone());
diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr
new file mode 100644
index 000000000..6d19c3beb
--- /dev/null
+++ b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr
@@ -0,0 +1,11 @@
+error[E0070]: invalid left-hand side of assignment
+ --> $DIR/issue-73741-type-err-drop-tracking.rs:11: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`.
diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr
new file mode 100644
index 000000000..6d19c3beb
--- /dev/null
+++ b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr
@@ -0,0 +1,11 @@
+error[E0070]: invalid left-hand side of assignment
+ --> $DIR/issue-73741-type-err-drop-tracking.rs:11: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`.
diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr
new file mode 100644
index 000000000..6d19c3beb
--- /dev/null
+++ b/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr
@@ -0,0 +1,11 @@
+error[E0070]: invalid left-hand side of assignment
+ --> $DIR/issue-73741-type-err-drop-tracking.rs:11: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`.
diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs b/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs
index c3423ad62..1fa8d6914 100644
--- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs
+++ b/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs
@@ -1,5 +1,8 @@
// edition:2018
-// compile-flags: -Zdrop-tracking
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
+//
// Regression test for issue #73741
// Ensures that we don't emit spurious errors when
// a type error ocurrs in an `async fn`
diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr
index d4e3b6c3b..6d19c3beb 100644
--- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr
+++ b/tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr
@@ -1,5 +1,5 @@
error[E0070]: invalid left-hand side of assignment
- --> $DIR/issue-73741-type-err-drop-tracking.rs:8:7
+ --> $DIR/issue-73741-type-err-drop-tracking.rs:11:7
|
LL | 1 = 2;
| - ^
diff --git a/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr b/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr
index b96cab9f0..628ba1a48 100644
--- a/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr
+++ b/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr
@@ -4,9 +4,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
LL | pub async fn async_fn(x: &mut i32) -> &i32 {
| - let's call the lifetime of this reference `'1`
LL | let y = &*x;
- | --- borrow of `*x` occurs here
+ | --- `*x` is borrowed here
LL | *x += 1;
- | ^^^^^^^ assignment to borrowed `*x` occurs here
+ | ^^^^^^^ `*x` is assigned to here but it was already borrowed
LL | y
| - returning this value requires that `*x` is borrowed for `'1`
@@ -14,9 +14,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
--> $DIR/issue-74072-lifetime-name-annotations.rs:16:9
|
LL | let y = &*x;
- | --- borrow of `*x` occurs here
+ | --- `*x` is borrowed here
LL | *x += 1;
- | ^^^^^^^ assignment to borrowed `*x` occurs here
+ | ^^^^^^^ `*x` is assigned to here but it was already borrowed
LL | y
| - returning this value requires that `*x` is borrowed for `'1`
LL | })()
@@ -28,9 +28,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
LL | (async move || -> &i32 {
| - let's call the lifetime of this reference `'1`
LL | let y = &*x;
- | --- borrow of `*x` occurs here
+ | --- `*x` is borrowed here
LL | *x += 1;
- | ^^^^^^^ assignment to borrowed `*x` occurs here
+ | ^^^^^^^ `*x` is assigned to here but it was already borrowed
LL | y
| - returning this value requires that `*x` is borrowed for `'1`
@@ -38,9 +38,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
--> $DIR/issue-74072-lifetime-name-annotations.rs:32:9
|
LL | let y = &*x;
- | --- borrow of `*x` occurs here
+ | --- `*x` is borrowed here
LL | *x += 1;
- | ^^^^^^^ assignment to borrowed `*x` occurs here
+ | ^^^^^^^ `*x` is assigned to here but it was already borrowed
LL | y
| - returning this value requires that `*x` is borrowed for `'1`
LL | }
diff --git a/tests/ui/async-await/issue-75785-confusing-named-region.stderr b/tests/ui/async-await/issue-75785-confusing-named-region.stderr
index 3b731d9c6..b69033a0e 100644
--- a/tests/ui/async-await/issue-75785-confusing-named-region.stderr
+++ b/tests/ui/async-await/issue-75785-confusing-named-region.stderr
@@ -4,9 +4,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed
LL | pub async fn async_fn(x: &mut i32) -> (&i32, &i32) {
| - let's call the lifetime of this reference `'1`
LL | let y = &*x;
- | --- borrow of `*x` occurs here
+ | --- `*x` is borrowed here
LL | *x += 1;
- | ^^^^^^^ assignment to borrowed `*x` occurs here
+ | ^^^^^^^ `*x` is assigned to here but it was already borrowed
LL | (&32, y)
| -------- returning this value requires that `*x` is borrowed for `'1`
diff --git a/tests/ui/async-await/issue-86507.stderr b/tests/ui/async-await/issue-86507.drop_tracking.stderr
index 8c2c06da2..5c8b7ef1b 100644
--- a/tests/ui/async-await/issue-86507.stderr
+++ b/tests/ui/async-await/issue-86507.drop_tracking.stderr
@@ -1,5 +1,5 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-86507.rs:17:13
+ --> $DIR/issue-86507.rs:20:13
|
LL | / Box::pin(
LL | | async move {
@@ -9,11 +9,11 @@ LL | | )
| |_____________^ future created by async block is not `Send`
|
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
- --> $DIR/issue-86507.rs:19:29
+ --> $DIR/issue-86507.rs:22:29
|
LL | let x = x;
| ^ has type `&T` which is not `Send`, because `T` is not `Sync`
- = note: required for the cast from `[async block@$DIR/issue-86507.rs:18:17: 20:18]` to the object type `dyn Future<Output = ()> + Send`
+ = note: required for the cast from `[async block@$DIR/issue-86507.rs:21:17: 23:18]` to the object type `dyn Future<Output = ()> + Send`
help: consider further restricting this bound
|
LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
diff --git a/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr b/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr
new file mode 100644
index 000000000..5c8b7ef1b
--- /dev/null
+++ b/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr
@@ -0,0 +1,23 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-86507.rs:20:13
+ |
+LL | / Box::pin(
+LL | | async move {
+LL | | let x = x;
+LL | | }
+LL | | )
+ | |_____________^ future created by async block is not `Send`
+ |
+note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
+ --> $DIR/issue-86507.rs:22:29
+ |
+LL | let x = x;
+ | ^ has type `&T` which is not `Send`, because `T` is not `Sync`
+ = note: required for the cast from `[async block@$DIR/issue-86507.rs:21:17: 23:18]` to the object type `dyn Future<Output = ()> + Send`
+help: consider further restricting this bound
+ |
+LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
+ | +++++++++++++++++++
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-86507.no_drop_tracking.stderr b/tests/ui/async-await/issue-86507.no_drop_tracking.stderr
new file mode 100644
index 000000000..5c8b7ef1b
--- /dev/null
+++ b/tests/ui/async-await/issue-86507.no_drop_tracking.stderr
@@ -0,0 +1,23 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-86507.rs:20:13
+ |
+LL | / Box::pin(
+LL | | async move {
+LL | | let x = x;
+LL | | }
+LL | | )
+ | |_____________^ future created by async block is not `Send`
+ |
+note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
+ --> $DIR/issue-86507.rs:22:29
+ |
+LL | let x = x;
+ | ^ has type `&T` which is not `Send`, because `T` is not `Sync`
+ = note: required for the cast from `[async block@$DIR/issue-86507.rs:21:17: 23:18]` to the object type `dyn Future<Output = ()> + Send`
+help: consider further restricting this bound
+ |
+LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
+ | +++++++++++++++++++
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-86507.rs b/tests/ui/async-await/issue-86507.rs
index 317f03176..63c298dbe 100644
--- a/tests/ui/async-await/issue-86507.rs
+++ b/tests/ui/async-await/issue-86507.rs
@@ -1,3 +1,6 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
use ::core::pin::Pin;
diff --git a/tests/ui/async-await/issue-93648.rs b/tests/ui/async-await/issue-93648.rs
index 4ce3ac1e8..ec2249ca5 100644
--- a/tests/ui/async-await/issue-93648.rs
+++ b/tests/ui/async-await/issue-93648.rs
@@ -1,6 +1,8 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2021
// build-pass
-// compile-flags: -Zdrop-tracking
fn main() {
let _ = async {
diff --git a/tests/ui/async-await/issue-98634.rs b/tests/ui/async-await/issue-98634.rs
index b0d38687f..169cc7f9b 100644
--- a/tests/ui/async-await/issue-98634.rs
+++ b/tests/ui/async-await/issue-98634.rs
@@ -43,8 +43,8 @@ impl Runtime {
fn main() {
Runtime.block_on(async {
StructAsync { callback }.await;
- //~^ ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
- //~| ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
- //~| ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
+ //~^ ERROR expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
+ //~| ERROR expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
+ //~| ERROR expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
});
}
diff --git a/tests/ui/async-await/issue-98634.stderr b/tests/ui/async-await/issue-98634.stderr
index 5160e48d8..5b7f18a98 100644
--- a/tests/ui/async-await/issue-98634.stderr
+++ b/tests/ui/async-await/issue-98634.stderr
@@ -1,54 +1,33 @@
-error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
+error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
--> $DIR/issue-98634.rs:45:23
|
LL | StructAsync { callback }.await;
- | ^^^^^^^^ expected struct `Pin`, found opaque type
+ | ^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found future
|
-note: while checking the return type of the `async fn`
- --> $DIR/issue-98634.rs:24:21
- |
-LL | async fn callback() {}
- | ^ checked the `Output` of this `async fn`, found opaque type
- = note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
- found opaque type `impl Future<Output = ()>`
note: required by a bound in `StructAsync`
--> $DIR/issue-98634.rs:9:35
|
LL | pub struct StructAsync<F: Fn() -> Pin<Box<dyn Future<Output = ()>>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync`
-error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
+error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
--> $DIR/issue-98634.rs:45:9
|
LL | StructAsync { callback }.await;
- | ^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type
- |
-note: while checking the return type of the `async fn`
- --> $DIR/issue-98634.rs:24:21
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found future
|
-LL | async fn callback() {}
- | ^ checked the `Output` of this `async fn`, found opaque type
- = note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
- found opaque type `impl Future<Output = ()>`
note: required by a bound in `StructAsync`
--> $DIR/issue-98634.rs:9:35
|
LL | pub struct StructAsync<F: Fn() -> Pin<Box<dyn Future<Output = ()>>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync`
-error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
+error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
--> $DIR/issue-98634.rs:45:33
|
LL | StructAsync { callback }.await;
- | ^^^^^^ expected struct `Pin`, found opaque type
- |
-note: while checking the return type of the `async fn`
- --> $DIR/issue-98634.rs:24:21
+ | ^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found future
|
-LL | async fn callback() {}
- | ^ checked the `Output` of this `async fn`, found opaque type
- = note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
- found opaque type `impl Future<Output = ()>`
note: required by a bound in `StructAsync`
--> $DIR/issue-98634.rs:9:35
|
diff --git a/tests/ui/async-await/issues/auxiliary/issue_67893.rs b/tests/ui/async-await/issues/auxiliary/issue_67893.rs
index 387966a50..d53944698 100644
--- a/tests/ui/async-await/issues/auxiliary/issue_67893.rs
+++ b/tests/ui/async-await/issues/auxiliary/issue_67893.rs
@@ -1,3 +1,6 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
use std::sync::{Arc, Mutex};
diff --git a/tests/ui/async-await/issues/issue-102206.stderr b/tests/ui/async-await/issues/issue-102206.stderr
index 2ab790ac7..750b7a886 100644
--- a/tests/ui/async-await/issues/issue-102206.stderr
+++ b/tests/ui/async-await/issues/issue-102206.stderr
@@ -4,17 +4,10 @@ error[E0308]: mismatched types
LL | std::mem::size_of_val(foo());
| --------------------- ^^^^^
| | |
- | | expected reference, found opaque type
+ | | expected `&_`, found future
| | help: consider borrowing here: `&foo()`
| arguments to this function are incorrect
|
-note: while checking the return type of the `async fn`
- --> $DIR/issue-102206.rs:3:16
- |
-LL | async fn foo() {}
- | ^ checked the `Output` of this `async fn`, found opaque type
- = note: expected reference `&_`
- found opaque type `impl Future<Output = ()>`
note: function defined here
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
diff --git a/tests/ui/async-await/issues/issue-107280.rs b/tests/ui/async-await/issues/issue-107280.rs
new file mode 100644
index 000000000..85fce8740
--- /dev/null
+++ b/tests/ui/async-await/issues/issue-107280.rs
@@ -0,0 +1,15 @@
+// edition:2021
+
+async fn foo() {
+ inner::<false>().await
+ //~^ ERROR: function takes 2 generic arguments but 1 generic argument was supplied
+ //~| ERROR: type inside `async fn` body must be known in this context
+ //~| ERROR: type inside `async fn` body must be known in this context
+ //~| ERROR: type inside `async fn` body must be known in this context
+ //~| ERROR: type inside `async fn` body must be known in this context
+ //~| ERROR: type inside `async fn` body must be known in this context
+}
+
+async fn inner<T, const PING: bool>() {}
+
+fn main() {}
diff --git a/tests/ui/async-await/issues/issue-107280.stderr b/tests/ui/async-await/issues/issue-107280.stderr
new file mode 100644
index 000000000..dd3e10fcc
--- /dev/null
+++ b/tests/ui/async-await/issues/issue-107280.stderr
@@ -0,0 +1,82 @@
+error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied
+ --> $DIR/issue-107280.rs:4:5
+ |
+LL | inner::<false>().await
+ | ^^^^^ ----- supplied 1 generic argument
+ | |
+ | expected 2 generic arguments
+ |
+note: function defined here, with 2 generic parameters: `T`, `PING`
+ --> $DIR/issue-107280.rs:13:10
+ |
+LL | async fn inner<T, const PING: bool>() {}
+ | ^^^^^ - ----------------
+help: add missing generic argument
+ |
+LL | inner::<false, PING>().await
+ | ++++++
+
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/issue-107280.rs:4:5
+ |
+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
+ |
+LL | inner::<false>().await
+ | ^^^^^^
+
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/issue-107280.rs:4:5
+ |
+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
+ |
+LL | inner::<false>().await
+ | ^^^^^^
+
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/issue-107280.rs:4:5
+ |
+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
+ |
+LL | inner::<false>().await
+ | ^^^^^^
+
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/issue-107280.rs:4:5
+ |
+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
+ |
+LL | inner::<false>().await
+ | ^^^^^^
+
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/issue-107280.rs:4:5
+ |
+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
+ |
+LL | inner::<false>().await
+ | ^^^^^^
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0107, E0698.
+For more information about an error, try `rustc --explain E0107`.
diff --git a/tests/ui/async-await/issues/issue-62097.rs b/tests/ui/async-await/issues/issue-62097.rs
index a24c84cff..13c72abb1 100644
--- a/tests/ui/async-await/issues/issue-62097.rs
+++ b/tests/ui/async-await/issues/issue-62097.rs
@@ -12,7 +12,7 @@ impl Struct {
pub async fn run_dummy_fn(&self) {
foo(|| self.bar()).await;
//~^ ERROR closure may outlive the current function
- //~| ERROR borrowed data escapes outside of associated function
+ //~| ERROR borrowed data escapes outside of method
}
pub fn bar(&self) {}
diff --git a/tests/ui/async-await/issues/issue-62097.stderr b/tests/ui/async-await/issues/issue-62097.stderr
index 786f62132..21a61548d 100644
--- a/tests/ui/async-await/issues/issue-62097.stderr
+++ b/tests/ui/async-await/issues/issue-62097.stderr
@@ -16,18 +16,18 @@ help: to force the closure to take ownership of `self` (and any other referenced
LL | foo(move || self.bar()).await;
| ++++
-error[E0521]: borrowed data escapes outside of associated function
+error[E0521]: borrowed data escapes outside of method
--> $DIR/issue-62097.rs:13:9
|
LL | pub async fn run_dummy_fn(&self) {
| -----
| |
- | `self` is a reference that is only valid in the associated function body
+ | `self` is a reference that is only valid in the method body
| let's call the lifetime of this reference `'1`
LL | foo(|| self.bar()).await;
| ^^^^^^^^^^^^^^^^^^
| |
- | `self` escapes the associated function body here
+ | `self` escapes the method body here
| argument requires that `'1` must outlive `'static`
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/issues/issue-65159.rs b/tests/ui/async-await/issues/issue-65159.rs
index df2ca0257..6e547508b 100644
--- a/tests/ui/async-await/issues/issue-65159.rs
+++ b/tests/ui/async-await/issues/issue-65159.rs
@@ -3,7 +3,7 @@
// edition:2018
async fn copy() -> Result<()>
-//~^ ERROR this enum takes 2 generic arguments
+//~^ ERROR enum takes 2 generic arguments
{
Ok(())
}
diff --git a/tests/ui/async-await/issues/issue-65159.stderr b/tests/ui/async-await/issues/issue-65159.stderr
index 40c0e72b2..b8741333c 100644
--- a/tests/ui/async-await/issues/issue-65159.stderr
+++ b/tests/ui/async-await/issues/issue-65159.stderr
@@ -1,4 +1,4 @@
-error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied
+error[E0107]: enum takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/issue-65159.rs:5:20
|
LL | async fn copy() -> Result<()>
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 1033fa6cc..8745bdd97 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
@@ -1,5 +1,5 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-65436-raw-ptr-not-send.rs:16:17
+ --> $DIR/issue-65436-raw-ptr-not-send.rs:17:17
|
LL | assert_send(async {
| _________________^
@@ -8,9 +8,9 @@ LL | | bar(Foo(std::ptr::null())).await;
LL | | })
| |_____^ future created by async block is not `Send`
|
- = help: within `[async block@$DIR/issue-65436-raw-ptr-not-send.rs:16:17: 19:6]`, the trait `Send` is not implemented for `*const u8`
+ = 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:18:35
+ --> $DIR/issue-65436-raw-ptr-not-send.rs:19:35
|
LL | bar(Foo(std::ptr::null())).await;
| ---------------- ^^^^^^- `std::ptr::null()` is later dropped here
@@ -18,12 +18,12 @@ LL | bar(Foo(std::ptr::null())).await;
| | 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:18:13
+ --> $DIR/issue-65436-raw-ptr-not-send.rs:19:13
|
LL | bar(Foo(std::ptr::null())).await;
| ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `assert_send`
- --> $DIR/issue-65436-raw-ptr-not-send.rs:13:19
+ --> $DIR/issue-65436-raw-ptr-not-send.rs:14:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
index 91edbc10d..d7ef92951 100644
--- a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
+++ b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
@@ -1,8 +1,9 @@
// edition:2018
-// revisions: no_drop_tracking drop_tracking
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// [drop_tracking] check-pass
-// [drop_tracking] compile-flags: -Zdrop-tracking=yes
-// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
+// [drop_tracking_mir] check-pass
struct Foo(*const u8);
diff --git a/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs b/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs
index dda4a151d..c4f8f607d 100644
--- a/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs
+++ b/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs
@@ -1,6 +1,10 @@
// build-pass
// edition:2018
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
+
static mut A: [i32; 5] = [1, 2, 3, 4, 5];
fn is_send_sync<T: Send + Sync>(_: T) {}
diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr
index 2ce68a782..ce9424c8b 100644
--- a/tests/ui/async-await/issues/issue-67893.stderr
+++ b/tests/ui/async-await/issues/issue-67893.stderr
@@ -6,7 +6,7 @@ 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:9:26
+ --> $DIR/auxiliary/issue_67893.rs:12:26
|
LL | f(*x.lock().unwrap()).await;
| ----------------- ^^^^^^- `x.lock().unwrap()` is later dropped here
diff --git a/tests/ui/async-await/issues/issue-72312.stderr b/tests/ui/async-await/issues/issue-72312.stderr
index aa947b690..679272858 100644
--- a/tests/ui/async-await/issues/issue-72312.stderr
+++ b/tests/ui/async-await/issues/issue-72312.stderr
@@ -1,10 +1,10 @@
-error[E0521]: borrowed data escapes outside of associated function
+error[E0521]: borrowed data escapes outside of method
--> $DIR/issue-72312.rs:12:9
|
LL | pub async fn start(&self) {
| -----
| |
- | `self` is a reference that is only valid in the associated function body
+ | `self` is a reference that is only valid in the method body
| let's call the lifetime of this reference `'1`
...
LL | / require_static(async move {
@@ -15,7 +15,7 @@ LL | | &self;
LL | | });
| | ^
| | |
- | |__________`self` escapes the associated function body here
+ | |__________`self` escapes the method body here
| argument requires that `'1` must outlive `'static`
error: aborting due to previous error
diff --git a/tests/ui/async-await/multiple-lifetimes/member-constraints-min-choice-issue-63033.rs b/tests/ui/async-await/multiple-lifetimes/member-constraints-min-choice-issue-63033.rs
new file mode 100644
index 000000000..614f18972
--- /dev/null
+++ b/tests/ui/async-await/multiple-lifetimes/member-constraints-min-choice-issue-63033.rs
@@ -0,0 +1,10 @@
+// Regression test for #63033.
+
+// check-pass
+// edition: 2018
+
+async fn test1(_: &'static u8, _: &'_ u8, _: &'_ u8) {}
+
+async fn test2<'s>(_: &'s u8, _: &'_ &'s u8, _: &'_ &'s u8) {}
+
+fn main() {}
diff --git a/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr b/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr
index ae4d0d585..5ae1d78a9 100644
--- a/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr
+++ b/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr
@@ -17,8 +17,9 @@ error[E0700]: hidden type for `impl Trait<'a>` captures lifetime that does not a
--> $DIR/ret-impl-trait-one.rs:16:80
|
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
- | ____________________________________--__________________________________________^
- | | |
+ | ____________________________________--___________________________--------------_^
+ | | | |
+ | | | opaque type defined here
| | hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
LL | |
LL | | (a, b)
diff --git a/tests/ui/async-await/multiple-lifetimes/ret-ref.stderr b/tests/ui/async-await/multiple-lifetimes/ret-ref.stderr
index d86e84033..a599ac1d9 100644
--- a/tests/ui/async-await/multiple-lifetimes/ret-ref.stderr
+++ b/tests/ui/async-await/multiple-lifetimes/ret-ref.stderr
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `a` because it is borrowed
--> $DIR/ret-ref.rs:16:5
|
LL | let future = multiple_named_lifetimes(&a, &b);
- | -- borrow of `a` occurs here
+ | -- `a` is borrowed here
LL | a += 1;
- | ^^^^^^ assignment to borrowed `a` occurs here
+ | ^^^^^^ `a` is assigned to here but it was already borrowed
LL | b += 1;
LL | let p = future.await;
| ------ borrow later used here
@@ -13,10 +13,10 @@ error[E0506]: cannot assign to `b` because it is borrowed
--> $DIR/ret-ref.rs:17:5
|
LL | let future = multiple_named_lifetimes(&a, &b);
- | -- borrow of `b` occurs here
+ | -- `b` is borrowed here
LL | a += 1;
LL | b += 1;
- | ^^^^^^ assignment to borrowed `b` occurs here
+ | ^^^^^^ `b` is assigned to here but it was already borrowed
LL | let p = future.await;
| ------ borrow later used here
@@ -24,10 +24,10 @@ error[E0506]: cannot assign to `a` because it is borrowed
--> $DIR/ret-ref.rs:28:5
|
LL | let future = multiple_named_lifetimes(&a, &b);
- | -- borrow of `a` occurs here
+ | -- `a` is borrowed here
LL | let p = future.await;
LL | a += 1;
- | ^^^^^^ assignment to borrowed `a` occurs here
+ | ^^^^^^ `a` is assigned to here but it was already borrowed
LL | b += 1;
LL | drop(p);
| - borrow later used here
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr
new file mode 100644
index 000000000..8a7317bb9
--- /dev/null
+++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr
@@ -0,0 +1,21 @@
+error[E0733]: recursion in an `async fn` requires boxing
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
+ |
+LL | async fn rec_1() {
+ | ^ recursive `async fn`
+ |
+ = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
+ = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
+
+error[E0733]: recursion in an `async fn` requires boxing
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
+ |
+LL | async fn rec_2() {
+ | ^ recursive `async fn`
+ |
+ = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
+ = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr
new file mode 100644
index 000000000..8a7317bb9
--- /dev/null
+++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr
@@ -0,0 +1,21 @@
+error[E0733]: recursion in an `async fn` requires boxing
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
+ |
+LL | async fn rec_1() {
+ | ^ recursive `async fn`
+ |
+ = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
+ = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
+
+error[E0733]: recursion in an `async fn` requires boxing
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
+ |
+LL | async fn rec_2() {
+ | ^ recursive `async fn`
+ |
+ = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
+ = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr
new file mode 100644
index 000000000..8a7317bb9
--- /dev/null
+++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr
@@ -0,0 +1,21 @@
+error[E0733]: recursion in an `async fn` requires boxing
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
+ |
+LL | async fn rec_1() {
+ | ^ recursive `async fn`
+ |
+ = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
+ = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
+
+error[E0733]: recursion in an `async fn` requires boxing
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
+ |
+LL | async fn rec_2() {
+ | ^ recursive `async fn`
+ |
+ = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
+ = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs
index bb2a61f03..a241f30e7 100644
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs
+++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs
@@ -1,3 +1,7 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
+
// edition:2018
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden when using `async` and `await`.
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
index f789ad2a0..8a7317bb9 100644
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
+++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
@@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:18
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
|
LL | async fn rec_1() {
| ^ recursive `async fn`
@@ -8,7 +8,7 @@ LL | async fn rec_1() {
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
|
LL | async fn rec_2() {
| ^ recursive `async fn`
diff --git a/tests/ui/async-await/no-const-async.stderr b/tests/ui/async-await/no-const-async.stderr
index c5bd520aa..71c228958 100644
--- a/tests/ui/async-await/no-const-async.stderr
+++ b/tests/ui/async-await/no-const-async.stderr
@@ -28,8 +28,8 @@ note: ...which requires const checking `x`...
|
LL | pub const async fn x() {}
| ^^^^^^^^^^^^^^^^^^^^^^
- = note: ...which requires computing whether `impl core::future::future::Future<Output = ()>` is freeze...
- = note: ...which requires evaluating trait selection obligation `impl core::future::future::Future<Output = ()>: core::marker::Freeze`...
+ = note: ...which requires computing whether `x::{opaque#0}` is freeze...
+ = note: ...which requires evaluating trait selection obligation `x::{opaque#0}: core::marker::Freeze`...
= note: ...which again requires computing type of `x::{opaque#0}`, completing the cycle
note: cycle used when checking item types in top-level module
--> $DIR/no-const-async.rs:4:1
diff --git a/tests/ui/async-await/non-trivial-drop.rs b/tests/ui/async-await/non-trivial-drop.rs
index a3167215d..d4df9d439 100644
--- a/tests/ui/async-await/non-trivial-drop.rs
+++ b/tests/ui/async-await/non-trivial-drop.rs
@@ -1,6 +1,8 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// build-pass
// edition:2018
-// compile-flags: -Zdrop-tracking=y
#![feature(generators)]
diff --git a/tests/ui/async-await/proper-span-for-type-error.stderr b/tests/ui/async-await/proper-span-for-type-error.stderr
index 25f05156c..592ef7faf 100644
--- a/tests/ui/async-await/proper-span-for-type-error.stderr
+++ b/tests/ui/async-await/proper-span-for-type-error.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/proper-span-for-type-error.rs:8:5
|
LL | a().await
- | ^^^^^^^^^ expected enum `Result`, found `()`
+ | ^^^^^^^^^ expected `Result<(), i32>`, found `()`
|
= note: expected enum `Result<(), i32>`
found unit type `()`
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr
new file mode 100644
index 000000000..7e63a8da5
--- /dev/null
+++ b/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr
@@ -0,0 +1,12 @@
+error[E0733]: recursion in an `async fn` requires boxing
+ --> $DIR/recursive-async-impl-trait-type.rs:8:40
+ |
+LL | async fn recursive_async_function() -> () {
+ | ^^ recursive `async fn`
+ |
+ = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
+ = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr
new file mode 100644
index 000000000..7e63a8da5
--- /dev/null
+++ b/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr
@@ -0,0 +1,12 @@
+error[E0733]: recursion in an `async fn` requires boxing
+ --> $DIR/recursive-async-impl-trait-type.rs:8:40
+ |
+LL | async fn recursive_async_function() -> () {
+ | ^^ recursive `async fn`
+ |
+ = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
+ = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr
new file mode 100644
index 000000000..7e63a8da5
--- /dev/null
+++ b/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr
@@ -0,0 +1,12 @@
+error[E0733]: recursion in an `async fn` requires boxing
+ --> $DIR/recursive-async-impl-trait-type.rs:8:40
+ |
+LL | async fn recursive_async_function() -> () {
+ | ^^ recursive `async fn`
+ |
+ = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
+ = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.rs b/tests/ui/async-await/recursive-async-impl-trait-type.rs
index edc4cb8ac..60b34d3a1 100644
--- a/tests/ui/async-await/recursive-async-impl-trait-type.rs
+++ b/tests/ui/async-await/recursive-async-impl-trait-type.rs
@@ -1,3 +1,6 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// edition:2018
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden when using `async` and `await`.
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
index 63f64f445..7e63a8da5 100644
--- a/tests/ui/async-await/recursive-async-impl-trait-type.stderr
+++ b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
@@ -1,5 +1,5 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/recursive-async-impl-trait-type.rs:5:40
+ --> $DIR/recursive-async-impl-trait-type.rs:8:40
|
LL | async fn recursive_async_function() -> () {
| ^^ recursive `async fn`
diff --git a/tests/ui/async-await/send-bound-async-closure.rs b/tests/ui/async-await/send-bound-async-closure.rs
new file mode 100644
index 000000000..4e9e7309b
--- /dev/null
+++ b/tests/ui/async-await/send-bound-async-closure.rs
@@ -0,0 +1,37 @@
+// edition: 2021
+// check-pass
+
+// This test verifies that we do not create a query cycle when typechecking has several inference
+// variables that point to the same generator interior type.
+
+use std::future::Future;
+use std::pin::Pin;
+use std::task::{Context, Poll};
+
+type ChannelTask = Pin<Box<dyn Future<Output = ()> + Send>>;
+
+pub fn register_message_type() -> ChannelTask {
+ Box::pin(async move {
+ let f = |__cx: &mut Context<'_>| Poll::<()>::Pending;
+ PollFn { f }.await
+ })
+}
+
+struct PollFn<F> {
+ f: F,
+}
+
+impl<F> Unpin for PollFn<F> {}
+
+impl<T, F> Future for PollFn<F>
+where
+ F: FnMut(&mut Context<'_>) -> Poll<T>,
+{
+ type Output = T;
+
+ fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<T> {
+ (&mut self.f)(cx)
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/suggest-missing-await-closure.stderr b/tests/ui/async-await/suggest-missing-await-closure.stderr
index a5958baff..d44af5b8d 100644
--- a/tests/ui/async-await/suggest-missing-await-closure.stderr
+++ b/tests/ui/async-await/suggest-missing-await-closure.stderr
@@ -2,17 +2,15 @@ error[E0308]: mismatched types
--> $DIR/suggest-missing-await-closure.rs:16:18
|
LL | take_u32(x)
- | -------- ^ expected `u32`, found opaque type
+ | -------- ^ expected `u32`, found future
| |
| arguments to this function are incorrect
|
-note: while checking the return type of the `async fn`
- --> $DIR/suggest-missing-await-closure.rs:8:24
+note: calling an async function returns a future
+ --> $DIR/suggest-missing-await-closure.rs:16:18
|
-LL | async fn make_u32() -> u32 {
- | ^^^ checked the `Output` of this `async fn`, found opaque type
- = note: expected type `u32`
- found opaque type `impl Future<Output = u32>`
+LL | take_u32(x)
+ | ^
note: function defined here
--> $DIR/suggest-missing-await-closure.rs:6:4
|
diff --git a/tests/ui/async-await/suggest-missing-await.stderr b/tests/ui/async-await/suggest-missing-await.stderr
index 1196601ac..f0ec34a6a 100644
--- a/tests/ui/async-await/suggest-missing-await.stderr
+++ b/tests/ui/async-await/suggest-missing-await.stderr
@@ -2,17 +2,15 @@ error[E0308]: mismatched types
--> $DIR/suggest-missing-await.rs:12:14
|
LL | take_u32(x)
- | -------- ^ expected `u32`, found opaque type
+ | -------- ^ expected `u32`, found future
| |
| arguments to this function are incorrect
|
-note: while checking the return type of the `async fn`
- --> $DIR/suggest-missing-await.rs:5:24
+note: calling an async function returns a future
+ --> $DIR/suggest-missing-await.rs:12:14
|
-LL | async fn make_u32() -> u32 {
- | ^^^ checked the `Output` of this `async fn`, found opaque type
- = note: expected type `u32`
- found opaque type `impl Future<Output = u32>`
+LL | take_u32(x)
+ | ^
note: function defined here
--> $DIR/suggest-missing-await.rs:3:4
|
@@ -27,15 +25,13 @@ error[E0308]: mismatched types
--> $DIR/suggest-missing-await.rs:22:5
|
LL | dummy()
- | ^^^^^^^ expected `()`, found opaque type
+ | ^^^^^^^ expected `()`, found future
|
-note: while checking the return type of the `async fn`
- --> $DIR/suggest-missing-await.rs:18:18
+note: calling an async function returns a future
+ --> $DIR/suggest-missing-await.rs:22:5
|
-LL | async fn dummy() {}
- | ^ checked the `Output` of this `async fn`, found opaque type
- = note: expected unit type `()`
- found opaque type `impl Future<Output = ()>`
+LL | dummy()
+ | ^^^^^^^
help: consider `await`ing on the `Future`
|
LL | dummy().await
@@ -55,16 +51,11 @@ LL | | dummy()
LL | |
LL | | } else {
LL | | dummy().await
- | | ^^^^^^^^^^^^^ expected opaque type, found `()`
+ | | ^^^^^^^^^^^^^ expected future, found `()`
LL | |
LL | | };
| |_____- `if` and `else` have incompatible types
|
-note: while checking the return type of the `async fn`
- --> $DIR/suggest-missing-await.rs:18:18
- |
-LL | async fn dummy() {}
- | ^ checked the `Output` of this `async fn`, expected opaque type
= note: expected opaque type `impl Future<Output = ()>`
found unit type `()`
help: consider `await`ing on the `Future`
@@ -82,16 +73,11 @@ LL | | 0 => dummy(),
LL | | 1 => dummy(),
| | ------- this is found to be of type `impl Future<Output = ()>`
LL | | 2 => dummy().await,
- | | ^^^^^^^^^^^^^ expected opaque type, found `()`
+ | | ^^^^^^^^^^^^^ expected future, found `()`
LL | |
LL | | };
| |_____- `match` arms have incompatible types
|
-note: while checking the return type of the `async fn`
- --> $DIR/suggest-missing-await.rs:18:18
- |
-LL | async fn dummy() {}
- | ^ checked the `Output` of this `async fn`, expected opaque type
= note: expected opaque type `impl Future<Output = ()>`
found unit type `()`
help: consider `await`ing on the `Future`
@@ -106,13 +92,8 @@ error[E0308]: mismatched types
LL | let _x = match dummy() {
| ------- this expression has type `impl Future<Output = ()>`
LL | () => {}
- | ^^ expected opaque type, found `()`
- |
-note: while checking the return type of the `async fn`
- --> $DIR/suggest-missing-await.rs:18:18
+ | ^^ expected future, found `()`
|
-LL | async fn dummy() {}
- | ^ checked the `Output` of this `async fn`, expected opaque type
= note: expected opaque type `impl Future<Output = ()>`
found unit type `()`
help: consider `await`ing on the `Future`
@@ -127,13 +108,8 @@ LL | match dummy_result() {
| -------------- this expression has type `impl Future<Output = Result<(), ()>>`
...
LL | Ok(_) => {}
- | ^^^^^ expected opaque type, found enum `Result`
+ | ^^^^^ expected future, found `Result<_, _>`
|
-note: while checking the return type of the `async fn`
- --> $DIR/suggest-missing-await.rs:57:28
- |
-LL | async fn dummy_result() -> Result<(), ()> {
- | ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type
= note: expected opaque type `impl Future<Output = Result<(), ()>>`
found enum `Result<_, _>`
help: consider `await`ing on the `Future`
@@ -148,13 +124,8 @@ LL | match dummy_result() {
| -------------- this expression has type `impl Future<Output = Result<(), ()>>`
...
LL | Err(_) => {}
- | ^^^^^^ expected opaque type, found enum `Result`
- |
-note: while checking the return type of the `async fn`
- --> $DIR/suggest-missing-await.rs:57:28
+ | ^^^^^^ expected future, found `Result<_, _>`
|
-LL | async fn dummy_result() -> Result<(), ()> {
- | ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type
= note: expected opaque type `impl Future<Output = Result<(), ()>>`
found enum `Result<_, _>`
help: consider `await`ing on the `Future`
diff --git a/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr b/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr
new file mode 100644
index 000000000..912e2b34c
--- /dev/null
+++ b/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr
@@ -0,0 +1,39 @@
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/unresolved_type_param.rs:12:5
+ |
+LL | bar().await;
+ | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
+ |
+note: the type is part of the `async fn` body because of this `await`
+ --> $DIR/unresolved_type_param.rs:12:10
+ |
+LL | bar().await;
+ | ^^^^^^
+
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/unresolved_type_param.rs:12:5
+ |
+LL | bar().await;
+ | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
+ |
+note: the type is part of the `async fn` body because of this `await`
+ --> $DIR/unresolved_type_param.rs:12:10
+ |
+LL | bar().await;
+ | ^^^^^^
+
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/unresolved_type_param.rs:12:5
+ |
+LL | bar().await;
+ | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
+ |
+note: the type is part of the `async fn` body because of this `await`
+ --> $DIR/unresolved_type_param.rs:12:10
+ |
+LL | bar().await;
+ | ^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0698`.
diff --git a/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr b/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr
new file mode 100644
index 000000000..95c799468
--- /dev/null
+++ b/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr
@@ -0,0 +1,14 @@
+error[E0282]: type annotations needed
+ --> $DIR/unresolved_type_param.rs:12:5
+ |
+LL | bar().await;
+ | ^^^ cannot infer type of the type parameter `T` declared on the function `bar`
+ |
+help: consider specifying the generic argument
+ |
+LL | bar::<T>().await;
+ | +++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr b/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr
new file mode 100644
index 000000000..16d618caa
--- /dev/null
+++ b/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr
@@ -0,0 +1,63 @@
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/unresolved_type_param.rs:12:5
+ |
+LL | bar().await;
+ | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
+ |
+note: the type is part of the `async fn` body because of this `await`
+ --> $DIR/unresolved_type_param.rs:12:10
+ |
+LL | bar().await;
+ | ^^^^^^
+
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/unresolved_type_param.rs:12:5
+ |
+LL | bar().await;
+ | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
+ |
+note: the type is part of the `async fn` body because of this `await`
+ --> $DIR/unresolved_type_param.rs:12:10
+ |
+LL | bar().await;
+ | ^^^^^^
+
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/unresolved_type_param.rs:12:5
+ |
+LL | bar().await;
+ | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
+ |
+note: the type is part of the `async fn` body because of this `await`
+ --> $DIR/unresolved_type_param.rs:12:10
+ |
+LL | bar().await;
+ | ^^^^^^
+
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/unresolved_type_param.rs:12:5
+ |
+LL | bar().await;
+ | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
+ |
+note: the type is part of the `async fn` body because of this `await`
+ --> $DIR/unresolved_type_param.rs:12:10
+ |
+LL | bar().await;
+ | ^^^^^^
+
+error[E0698]: type inside `async fn` body must be known in this context
+ --> $DIR/unresolved_type_param.rs:12:5
+ |
+LL | bar().await;
+ | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
+ |
+note: the type is part of the `async fn` body because of this `await`
+ --> $DIR/unresolved_type_param.rs:12:10
+ |
+LL | bar().await;
+ | ^^^^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0698`.
diff --git a/tests/ui/async-await/unresolved_type_param.rs b/tests/ui/async-await/unresolved_type_param.rs
index 6d6d80614..ca0a92b94 100644
--- a/tests/ui/async-await/unresolved_type_param.rs
+++ b/tests/ui/async-await/unresolved_type_param.rs
@@ -1,24 +1,36 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// 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
-// compile-flags: -Zdrop-tracking
async fn bar<T>() -> () {}
async fn foo() {
bar().await;
- //~^ ERROR type inside `async fn` body must be known in this context
- //~| ERROR type inside `async fn` body must be known in this context
- //~| ERROR type inside `async fn` body must be known in this context
- //~| NOTE cannot infer type for type parameter `T`
- //~| NOTE cannot infer type for type parameter `T`
- //~| NOTE cannot infer type for type parameter `T`
- //~| NOTE the type is part of the `async fn` body because of this `await`
- //~| NOTE the type is part of the `async fn` body because of this `await`
- //~| NOTE the type is part of the `async fn` body because of this `await`
- //~| NOTE in this expansion of desugaring of `await`
- //~| NOTE in this expansion of desugaring of `await`
- //~| NOTE in this expansion of desugaring of `await`
+ //[drop_tracking_mir]~^ ERROR type annotations needed
+ //[drop_tracking_mir]~| NOTE cannot infer type of the type parameter `T`
+ //[no_drop_tracking,drop_tracking]~^^^ ERROR type inside `async fn` body must be known in this context
+ //[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context
+ //[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context
+ //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
+ //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
+ //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
+ //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
+ //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
+ //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
+ //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
+ //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
+ //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
+ //[no_drop_tracking]~^^^^^^^^^^^^^^^ ERROR type inside `async fn` body must be known in this context
+ //[no_drop_tracking]~| ERROR type inside `async fn` body must be known in this context
+ //[no_drop_tracking]~| NOTE cannot infer type for type parameter `T`
+ //[no_drop_tracking]~| NOTE cannot infer type for type parameter `T`
+ //[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
+ //[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
+ //[no_drop_tracking]~| NOTE in this expansion of desugaring of `await`
+ //[no_drop_tracking]~| NOTE in this expansion of desugaring of `await`
}
fn main() {}
diff --git a/tests/ui/async-await/unresolved_type_param.stderr b/tests/ui/async-await/unresolved_type_param.stderr
index 7236c681f..64a31b5fc 100644
--- a/tests/ui/async-await/unresolved_type_param.stderr
+++ b/tests/ui/async-await/unresolved_type_param.stderr
@@ -1,35 +1,35 @@
error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:10:5
+ --> $DIR/unresolved_type_param.rs:13:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:10:10
+ --> $DIR/unresolved_type_param.rs:13:10
|
LL | bar().await;
| ^^^^^^
error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:10:5
+ --> $DIR/unresolved_type_param.rs:13:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:10:10
+ --> $DIR/unresolved_type_param.rs:13:10
|
LL | bar().await;
| ^^^^^^
error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:10:5
+ --> $DIR/unresolved_type_param.rs:13:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:10:10
+ --> $DIR/unresolved_type_param.rs:13:10
|
LL | bar().await;
| ^^^^^^