From 211d2ed07bb5dff7683fb021341db751cec2ca1e Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sat, 24 Jun 2023 10:02:54 +0000 Subject: [PATCH] Bless tests. --- .../async-await/async-await-let-else.stderr | 48 ++++++---- tests/ui/async-await/async-error-span.rs | 2 +- tests/ui/async-await/async-error-span.stderr | 13 ++- tests/ui/async-await/async-fn-nonsend.rs | 2 +- tests/ui/async-await/async-fn-nonsend.stderr | 6 -- .../ui/async-await/async-is-unwindsafe.stderr | 14 +-- tests/ui/async-await/await-sequence.rs | 1 - tests/ui/async-await/default-struct-update.rs | 1 - tests/ui/async-await/drop-and-assign.rs | 1 - .../drop-track-bad-field-in-fru.rs | 1 - .../drop-track-bad-field-in-fru.stderr | 4 +- .../drop-track-field-assign-nonsend.rs | 1 - .../drop-track-field-assign-nonsend.stderr | 8 +- .../ui/async-await/drop-track-field-assign.rs | 1 - ...drop-tracking-unresolved-typeck-results.rs | 3 - ...-tracking-unresolved-typeck-results.stderr | 40 +------- .../async-await/field-assign-nonsend.stderr | 2 - .../indirect-recursion-issue-112047.rs | 2 +- .../indirect-recursion-issue-112047.stderr | 9 +- tests/ui/async-await/issue-64130-1-sync.rs | 1 + .../ui/async-await/issue-64130-1-sync.stderr | 4 +- tests/ui/async-await/issue-64130-2-send.rs | 1 + .../ui/async-await/issue-64130-2-send.stderr | 4 +- tests/ui/async-await/issue-64130-3-other.rs | 1 + .../ui/async-await/issue-64130-3-other.stderr | 4 +- .../async-await/issue-64130-4-async-move.rs | 1 - .../issue-64130-non-send-future-diags.stderr | 2 - .../async-await/issue-67252-unnamed-future.rs | 3 +- .../issue-67252-unnamed-future.stderr | 20 ++-- tests/ui/async-await/issue-68112.rs | 2 +- tests/ui/async-await/issue-68112.stderr | 16 ++-- .../async-await/issue-70935-complex-spans.rs | 2 +- .../issue-70935-complex-spans.stderr | 40 ++++++-- tests/ui/async-await/issue-71137.stderr | 3 - tests/ui/async-await/issue-93197.rs | 1 - tests/ui/async-await/issue-93648.rs | 1 - .../issues/auxiliary/issue_67893.rs | 4 +- tests/ui/async-await/issues/issue-107280.rs | 5 - .../ui/async-await/issues/issue-107280.stderr | 67 +------------- .../issues/issue-65436-raw-ptr-not-send.rs | 1 - tests/ui/async-await/issues/issue-67893.rs | 2 +- .../ui/async-await/issues/issue-67893.stderr | 28 ++++-- tests/ui/async-await/non-trivial-drop.rs | 1 - .../partial-drop-partial-reinit.stderr | 2 +- .../issue-110963-early.current.stderr | 25 +++-- .../issue-110963-early.next.stderr | 25 +++-- .../issue-110963-early.stderr | 25 +++-- tests/ui/async-await/unresolved_type_param.rs | 14 +-- .../async-await/unresolved_type_param.stderr | 41 ++------- .../ui/borrowck/async-reference-generality.rs | 3 +- .../async-reference-generality.stderr | 27 ------ .../erase-error-in-mir-drop-tracking.rs | 23 ----- .../erase-error-in-mir-drop-tracking.stderr | 24 ----- .../subtyping-enforces-type-equality.stderr | 1 - tests/ui/generator/borrowing.stderr | 20 ++-- tests/ui/generator/clone-impl.stderr | 30 +++--- .../ui/generator/derived-drop-parent-expr.rs | 1 - tests/ui/generator/drop-control-flow.rs | 1 - .../generator/drop-track-addassign-yield.rs | 1 - .../ui/generator/drop-tracking-error-body.rs | 18 ---- .../generator/drop-tracking-error-body.stderr | 17 ---- .../drop-tracking-parent-expression.rs | 1 - .../drop-tracking-parent-expression.stderr | 36 +++----- .../drop-tracking-yielding-in-match-guards.rs | 1 - tests/ui/generator/drop-yield-twice.stderr | 15 +-- tests/ui/generator/issue-102645.rs | 2 - tests/ui/generator/issue-102645.stderr | 2 +- tests/ui/generator/issue-105084.rs | 2 - tests/ui/generator/issue-105084.stderr | 18 ++-- ...sue-110929-generator-conflict-error-ice.rs | 1 - ...110929-generator-conflict-error-ice.stderr | 2 +- tests/ui/generator/issue-57017.rs | 1 - tests/ui/generator/issue-57478.rs | 1 - tests/ui/generator/issue-68112.rs | 5 +- tests/ui/generator/issue-68112.stderr | 15 +-- tests/ui/generator/issue-93161.rs | 1 - tests/ui/generator/not-send-sync.rs | 16 +++- tests/ui/generator/not-send-sync.stderr | 74 ++++++--------- tests/ui/generator/parent-expression.rs | 2 - tests/ui/generator/parent-expression.stderr | 36 +++----- tests/ui/generator/partial-drop.rs | 14 +-- tests/ui/generator/partial-drop.stderr | 92 ------------------- .../print/generator-print-verbose-1.rs | 2 +- .../print/generator-print-verbose-1.stderr | 14 +-- .../print/generator-print-verbose-2.rs | 16 +++- .../print/generator-print-verbose-2.stderr | 74 ++++++--------- tests/ui/generator/retain-resume-ref.stderr | 7 +- tests/ui/generator/unresolved-ct-var.rs | 5 - tests/ui/generator/unresolved-ct-var.stderr | 65 +------------ ...eld.rs => unsized-capture-across-yield.rs} | 12 --- ...rr => unsized-capture-across-yield.stderr} | 15 +-- .../generator/unsized-local-across-yield.rs | 21 +++++ .../unsized-local-across-yield.stderr | 21 +++++ .../bugs/issue-100013.stderr | 30 ------ tests/ui/impl-trait/issue-55872-2.rs | 1 + tests/ui/impl-trait/issue-55872-2.stderr | 8 +- tests/ui/impl-trait/recursive-generator.rs | 1 - .../ui/impl-trait/recursive-generator.stderr | 15 +-- .../recursive-impl-trait-type-indirect.stderr | 15 +-- tests/ui/lint/must_not_suspend/dedup.rs | 5 +- tests/ui/lint/must_not_suspend/dedup.stderr | 15 +-- tests/ui/lint/must_not_suspend/ref.stderr | 14 +-- tests/ui/lint/must_not_suspend/unit.rs | 1 + tests/ui/lint/must_not_suspend/warn.rs | 3 +- tests/ui/lint/must_not_suspend/warn.stderr | 12 +-- .../new-solver/auto-with-drop_tracking_mir.rs | 2 +- tests/ui/traits/unsend-future.rs | 1 + tests/ui/traits/unsend-future.stderr | 4 +- .../indirect-recursion-issue-112047.rs | 2 +- .../indirect-recursion-issue-112047.stderr | 15 ++- 110 files changed, 486 insertions(+), 918 deletions(-) delete mode 100644 tests/ui/borrowck/async-reference-generality.stderr delete mode 100644 tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs delete mode 100644 tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr delete mode 100644 tests/ui/codegen/subtyping-enforces-type-equality.stderr delete mode 100644 tests/ui/generator/drop-tracking-error-body.rs delete mode 100644 tests/ui/generator/drop-tracking-error-body.stderr delete mode 100644 tests/ui/generator/partial-drop.stderr rename tests/ui/generator/{unsized-across-yield.rs => unsized-capture-across-yield.rs} (66%) rename tests/ui/generator/{unsized-across-yield.stderr => unsized-capture-across-yield.stderr} (61%) create mode 100644 tests/ui/generator/unsized-local-across-yield.rs create mode 100644 tests/ui/generator/unsized-local-across-yield.stderr diff --git a/tests/ui/async-await/async-await-let-else.stderr b/tests/ui/async-await/async-await-let-else.stderr index b47201502f6d9..9a1c1782233fc 100644 --- a/tests/ui/async-await/async-await-let-else.stderr +++ b/tests/ui/async-await/async-await-let-else.stderr @@ -12,30 +12,43 @@ 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:16:15 | LL | fn is_send(_: T) {} | ^^^^ required by this bound in `is_send` -error: future cannot be sent between threads safely +error[E0277]: `Rc<()>` cannot be sent between threads safely --> $DIR/async-await-let-else.rs:47:13 | +LL | async fn foo2(x: Option) { + | - within this `impl Future` +... LL | is_send(foo2(Some(true))); - | ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send` + | ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely + | | + | required by a bound introduced by this call | = help: within `impl Future`, 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:20:27 - | -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 because it's used within this `async fn` body + --> $DIR/async-await-let-else.rs:24:29 + | +LL | async fn bar2(_: T) -> ! { + | _____________________________^ +LL | | panic!() +LL | | } + | |_^ + = note: required because it captures the following types: `impl Future` +note: required because it's used within this `async fn` body + --> $DIR/async-await-let-else.rs:18:32 + | +LL | async fn foo2(x: Option) { + | ________________________________^ +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:16:15 | @@ -53,9 +66,8 @@ note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:30:29 | LL | (Rc::new(()), bar().await); - | ----------- ^^^^^ - `Rc::new(())` is later dropped here - | | | - | | await occurs here, with `Rc::new(())` maybe used later + | ----------- ^^^^^ 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:16:15 @@ -77,9 +89,6 @@ 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:16:15 | @@ -88,3 +97,4 @@ LL | fn is_send(_: T) {} 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-error-span.rs b/tests/ui/async-await/async-error-span.rs index 86d459bf084b1..c8127df625e68 100644 --- a/tests/ui/async-await/async-error-span.rs +++ b/tests/ui/async-await/async-error-span.rs @@ -10,7 +10,7 @@ fn get_future() -> impl Future { } async fn foo() { - let a; //~ ERROR type inside `async fn` body must be known in this context + let a; //~ ERROR type annotations needed get_future().await; } diff --git a/tests/ui/async-await/async-error-span.stderr b/tests/ui/async-await/async-error-span.stderr index 68fb385718eb7..2ec968ffc0307 100644 --- a/tests/ui/async-await/async-error-span.stderr +++ b/tests/ui/async-await/async-error-span.stderr @@ -7,19 +7,18 @@ LL | fn get_future() -> impl 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 +error[E0282]: type annotations needed --> $DIR/async-error-span.rs:13: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:18 +help: consider giving `a` an explicit type | -LL | get_future().await; - | ^^^^^ +LL | let a: /* Type */; + | ++++++++++++ error: aborting due to 2 previous errors -Some errors have detailed explanations: E0277, E0698. +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-fn-nonsend.rs b/tests/ui/async-await/async-fn-nonsend.rs index d7f8d7ac546c0..c5453b67ef5b6 100644 --- a/tests/ui/async-await/async-fn-nonsend.rs +++ b/tests/ui/async-await/async-fn-nonsend.rs @@ -1,5 +1,5 @@ // edition:2018 -// compile-flags: --crate-type lib -Zdrop-tracking +// compile-flags: --crate-type lib use std::{cell::RefCell, fmt::Debug, rc::Rc}; diff --git a/tests/ui/async-await/async-fn-nonsend.stderr b/tests/ui/async-await/async-fn-nonsend.stderr index 0d00fc072e14b..0ced6c36f4715 100644 --- a/tests/ui/async-await/async-fn-nonsend.stderr +++ b/tests/ui/async-await/async-fn-nonsend.stderr @@ -12,9 +12,6 @@ LL | match Some(non_send()) { | ---------------- has type `Option` 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:64:24 | @@ -36,9 +33,6 @@ LL | let f: &mut std::fmt::Formatter = &mut get_formatter(); ... 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:64:24 | diff --git a/tests/ui/async-await/async-is-unwindsafe.stderr b/tests/ui/async-await/async-is-unwindsafe.stderr index c21f8cfa51fea..eaa455380505e 100644 --- a/tests/ui/async-await/async-is-unwindsafe.stderr +++ b/tests/ui/async-await/async-is-unwindsafe.stderr @@ -1,18 +1,17 @@ error[E0277]: the type `&mut Context<'_>` may not be safely transferred across an unwind boundary - --> $DIR/async-is-unwindsafe.rs:12:19 + --> $DIR/async-is-unwindsafe.rs:12:5 | LL | is_unwindsafe(async { - | ___________________^ + | _____^^^^^^^^^^^^^_- + | | | + | | `&mut Context<'_>` may not be safely transferred across an unwind boundary LL | | LL | | use std::ptr::null; LL | | use std::task::{Context, RawWaker, RawWakerVTable, Waker}; ... | LL | | drop(cx_ref); LL | | }); - | | ^ - | | | - | |_____`&mut Context<'_>` may not be safely transferred across an unwind boundary - | within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}` + | |_____- within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}` | = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>` = note: `UnwindSafe` is implemented for `&Context<'_>`, but not for `&mut Context<'_>` @@ -24,9 +23,6 @@ LL | let cx_ref = &mut cx; LL | LL | async {}.await; // this needs an inner await point | ^^^^^ await occurs here, with `cx_ref` maybe used later -... -LL | }); - | - `cx_ref` is later dropped here note: required by a bound in `is_unwindsafe` --> $DIR/async-is-unwindsafe.rs:3:26 | diff --git a/tests/ui/async-await/await-sequence.rs b/tests/ui/async-await/await-sequence.rs index 726c4284ec15e..79f68dd606cda 100644 --- a/tests/ui/async-await/await-sequence.rs +++ b/tests/ui/async-await/await-sequence.rs @@ -1,5 +1,4 @@ // edition:2021 -// compile-flags: -Z drop-tracking // build-pass use std::collections::HashMap; diff --git a/tests/ui/async-await/default-struct-update.rs b/tests/ui/async-await/default-struct-update.rs index 64fb6280dd7bb..f4757e7cbaeb3 100644 --- a/tests/ui/async-await/default-struct-update.rs +++ b/tests/ui/async-await/default-struct-update.rs @@ -1,6 +1,5 @@ // build-pass // edition:2018 -// compile-flags: -Zdrop-tracking=y fn main() { let _ = foo(); diff --git a/tests/ui/async-await/drop-and-assign.rs b/tests/ui/async-await/drop-and-assign.rs index fa3f3303677da..ef39033a9d4bb 100644 --- a/tests/ui/async-await/drop-and-assign.rs +++ b/tests/ui/async-await/drop-and-assign.rs @@ -1,5 +1,4 @@ // edition:2021 -// compile-flags: -Zdrop-tracking // build-pass struct A; diff --git a/tests/ui/async-await/drop-track-bad-field-in-fru.rs b/tests/ui/async-await/drop-track-bad-field-in-fru.rs index 28ad7767583cf..667b288e676df 100644 --- a/tests/ui/async-await/drop-track-bad-field-in-fru.rs +++ b/tests/ui/async-await/drop-track-bad-field-in-fru.rs @@ -1,4 +1,3 @@ -// compile-flags: -Zdrop-tracking // edition: 2021 fn main() {} diff --git a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr index b49b15db64cee..721e01062937e 100644 --- a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr +++ b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr @@ -1,5 +1,5 @@ error[E0559]: variant `Option<_>::None` has no field named `value` - --> $DIR/drop-track-bad-field-in-fru.rs:7:12 + --> $DIR/drop-track-bad-field-in-fru.rs:6:12 | LL | None { value: (), ..Default::default() }.await; | ^^^^^ `Option<_>::None` does not have this field @@ -7,7 +7,7 @@ LL | None { value: (), ..Default::default() }.await; = note: all struct fields are already assigned error[E0277]: `Option<_>` is not a future - --> $DIR/drop-track-bad-field-in-fru.rs:7:46 + --> $DIR/drop-track-bad-field-in-fru.rs:6:46 | LL | None { value: (), ..Default::default() }.await; | -^^^^^ 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 b6c0fda15216a..19315ef19f90f 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,5 @@ // 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-nonsend.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr index f36207b38a1ae..6c235916d647e 100644 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.stderr +++ b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr @@ -1,22 +1,20 @@ error: future cannot be sent between threads safely - --> $DIR/drop-track-field-assign-nonsend.rs:43:17 + --> $DIR/drop-track-field-assign-nonsend.rs:42:17 | LL | assert_send(agent.handle()); | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` | = help: within `impl Future`, the trait `Send` is not implemented for `Rc` note: future is not `Send` as this value is used across an await - --> $DIR/drop-track-field-assign-nonsend.rs:21:39 + --> $DIR/drop-track-field-assign-nonsend.rs:20:39 | 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:38:19 + --> $DIR/drop-track-field-assign-nonsend.rs:37:19 | LL | fn assert_send(_: T) {} | ^^^^ required by this bound in `assert_send` diff --git a/tests/ui/async-await/drop-track-field-assign.rs b/tests/ui/async-await/drop-track-field-assign.rs index cfea7db2a1036..4887eff7efa29 100644 --- a/tests/ui/async-await/drop-track-field-assign.rs +++ b/tests/ui/async-await/drop-track-field-assign.rs @@ -1,6 +1,5 @@ // 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/drop-tracking-unresolved-typeck-results.rs b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs index 7f72942958141..9f80b9c6e9f4b 100644 --- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs +++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs @@ -1,4 +1,3 @@ -// compile-flags: -Zdrop-tracking // incremental // edition: 2021 @@ -99,8 +98,6 @@ fn main() { send(async { //~^ ERROR implementation of `FnOnce` is not general enough //~| ERROR implementation of `FnOnce` is not general enough - //~| ERROR implementation of `FnOnce` is not general enough - //~| ERROR implementation of `FnOnce` is not general enough Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await }); } diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr index aa9a22e9e72ea..cfb0ebe38b668 100644 --- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr +++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr @@ -1,26 +1,9 @@ error: implementation of `FnOnce` is not general enough - --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5 + --> $DIR/drop-tracking-unresolved-typeck-results.rs:98:5 | LL | / send(async { LL | | LL | | -LL | | -LL | | -LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await -LL | | }); - | |______^ implementation of `FnOnce` is not general enough - | - = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `FnOnce<(&(),)>` - -error: implementation of `FnOnce` is not general enough - --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5 - | -LL | / send(async { -LL | | -LL | | -LL | | -LL | | LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await LL | | }); | |______^ implementation of `FnOnce` is not general enough @@ -29,28 +12,11 @@ LL | | }); = note: ...but it actually implements `FnOnce<(&(),)>` error: implementation of `FnOnce` is not general enough - --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5 + --> $DIR/drop-tracking-unresolved-typeck-results.rs:98:5 | LL | / send(async { LL | | LL | | -LL | | -LL | | -LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await -LL | | }); - | |______^ implementation of `FnOnce` is not general enough - | - = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `FnOnce<(&(),)>` - -error: implementation of `FnOnce` is not general enough - --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5 - | -LL | / send(async { -LL | | -LL | | -LL | | -LL | | LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await LL | | }); | |______^ implementation of `FnOnce` is not general enough @@ -58,5 +24,5 @@ LL | | }); = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&(),)>` -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/field-assign-nonsend.stderr b/tests/ui/async-await/field-assign-nonsend.stderr index 481b236bbdb11..3037d7024472d 100644 --- a/tests/ui/async-await/field-assign-nonsend.stderr +++ b/tests/ui/async-await/field-assign-nonsend.stderr @@ -13,8 +13,6 @@ LL | let mut info = self.info_result.clone(); ... 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:37:19 | diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs index 85d17ddff94d8..2fe6b473df670 100644 --- a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs +++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs @@ -1,6 +1,6 @@ // edition: 2021 // build-fail -//~^^ ERROR overflow evaluating the requirement `::{opaque#0} == _` +//~^^ ERROR cycle detected when computing layout of #![feature(async_fn_in_trait)] diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr index 3f487a6e5fe58..e0c1acfedfc36 100644 --- a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr +++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr @@ -1,5 +1,10 @@ -error[E0275]: overflow evaluating the requirement `::{opaque#0} == _` +error[E0391]: cycle detected when computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}` + | + = note: ...which requires computing layout of `<::Second as Second>::{opaque#0}`... + = note: ...which again requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`, completing the cycle + = note: cycle used when computing layout of `::second::{opaque#0}` + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to previous error -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/async-await/issue-64130-1-sync.rs b/tests/ui/async-await/issue-64130-1-sync.rs index 1714cec5221de..7769085a0db8e 100644 --- a/tests/ui/async-await/issue-64130-1-sync.rs +++ b/tests/ui/async-await/issue-64130-1-sync.rs @@ -13,6 +13,7 @@ fn is_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 06d26ea73dc9e..207e085d273f0 100644 --- a/tests/ui/async-await/issue-64130-1-sync.stderr +++ b/tests/ui/async-await/issue-64130-1-sync.stderr @@ -1,5 +1,5 @@ error: future cannot be shared between threads safely - --> $DIR/issue-64130-1-sync.rs:21:13 + --> $DIR/issue-64130-1-sync.rs:22:13 | LL | is_sync(bar()); | ^^^^^ future returned by `bar` is not `Sync` @@ -12,8 +12,6 @@ LL | let x = Foo; | - has type `Foo` which is not `Sync` LL | baz().await; | ^^^^^ await occurs here, with `x` maybe used later -LL | } - | - `x` is later dropped here note: required by a bound in `is_sync` --> $DIR/issue-64130-1-sync.rs:11:15 | diff --git a/tests/ui/async-await/issue-64130-2-send.rs b/tests/ui/async-await/issue-64130-2-send.rs index 7a6e5952cb956..0195afe6b3924 100644 --- a/tests/ui/async-await/issue-64130-2-send.rs +++ b/tests/ui/async-await/issue-64130-2-send.rs @@ -13,6 +13,7 @@ fn is_send(t: T) { } async fn bar() { let x = Foo; baz().await; + drop(x); } async fn baz() { } diff --git a/tests/ui/async-await/issue-64130-2-send.stderr b/tests/ui/async-await/issue-64130-2-send.stderr index e71c78d6800e8..a433c76ae7088 100644 --- a/tests/ui/async-await/issue-64130-2-send.stderr +++ b/tests/ui/async-await/issue-64130-2-send.stderr @@ -1,5 +1,5 @@ error: future cannot be sent between threads safely - --> $DIR/issue-64130-2-send.rs:21:13 + --> $DIR/issue-64130-2-send.rs:22:13 | LL | is_send(bar()); | ^^^^^ future returned by `bar` is not `Send` @@ -12,8 +12,6 @@ LL | let x = Foo; | - has type `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:11:15 | diff --git a/tests/ui/async-await/issue-64130-3-other.rs b/tests/ui/async-await/issue-64130-3-other.rs index 630fb2c41cded..074d67aa3fb87 100644 --- a/tests/ui/async-await/issue-64130-3-other.rs +++ b/tests/ui/async-await/issue-64130-3-other.rs @@ -16,6 +16,7 @@ fn is_qux(t: T) {} async fn bar() { let x = Foo; baz().await; + drop(x); } async fn baz() {} diff --git a/tests/ui/async-await/issue-64130-3-other.stderr b/tests/ui/async-await/issue-64130-3-other.stderr index 4107784395f31..573da1034c573 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` - --> $DIR/issue-64130-3-other.rs:24:12 + --> $DIR/issue-64130-3-other.rs:25:12 | LL | async fn bar() { | - within this `impl Future` @@ -14,8 +14,6 @@ LL | let x = Foo; | - has type `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:14:14 | 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 c333e160ef3d2..359813f637957 100644 --- a/tests/ui/async-await/issue-64130-4-async-move.rs +++ b/tests/ui/async-await/issue-64130-4-async-move.rs @@ -1,6 +1,5 @@ // edition:2018 // check-pass -// compile-flags: -Zdrop-tracking=yes use std::any::Any; use std::future::Future; diff --git a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr index e044e2ca011f0..cb02fcf5ce782 100644 --- a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr +++ b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr @@ -12,8 +12,6 @@ LL | let g = x.lock().unwrap(); | - has type `MutexGuard<'_, u32>` which is not `Send` LL | baz().await; | ^^^^^ await occurs here, with `g` maybe used later -LL | } - | - `g` is later dropped here note: required by a bound in `is_send` --> $DIR/issue-64130-non-send-future-diags.rs:9:15 | diff --git a/tests/ui/async-await/issue-67252-unnamed-future.rs b/tests/ui/async-await/issue-67252-unnamed-future.rs index 1a7ff613341ec..60717d99346ac 100644 --- a/tests/ui/async-await/issue-67252-unnamed-future.rs +++ b/tests/ui/async-await/issue-67252-unnamed-future.rs @@ -16,8 +16,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; + let _a = a; }); } diff --git a/tests/ui/async-await/issue-67252-unnamed-future.stderr b/tests/ui/async-await/issue-67252-unnamed-future.stderr index 6aef35de0cac5..069befa912162 100644 --- a/tests/ui/async-await/issue-67252-unnamed-future.stderr +++ b/tests/ui/async-await/issue-67252-unnamed-future.stderr @@ -1,23 +1,17 @@ error: future cannot be sent between threads safely - --> $DIR/issue-67252-unnamed-future.rs:18:11 + --> $DIR/issue-67252-unnamed-future.rs:18:5 | -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` +LL | spawn(async { + | ^^^^^ 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 ()` + = help: within `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 22: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:17 | -LL | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` - | -- has type `*mut ()` which is not `Send` +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 + | ^^^^^ await occurs here, with `a` maybe used later note: required by a bound in `spawn` --> $DIR/issue-67252-unnamed-future.rs:6:13 | diff --git a/tests/ui/async-await/issue-68112.rs b/tests/ui/async-await/issue-68112.rs index 0005b90efc2ce..fd6089e0c03b9 100644 --- a/tests/ui/async-await/issue-68112.rs +++ b/tests/ui/async-await/issue-68112.rs @@ -11,7 +11,7 @@ use std::{ fn require_send(_: impl Send) {} struct Ready(Option); -impl Future for Ready { +impl Future for Ready { type Output = T; fn poll(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll { Poll::Ready(self.0.take().unwrap()) diff --git a/tests/ui/async-await/issue-68112.stderr b/tests/ui/async-await/issue-68112.stderr index aec2541c9e6c7..17b619ebee32a 100644 --- a/tests/ui/async-await/issue-68112.stderr +++ b/tests/ui/async-await/issue-68112.stderr @@ -1,8 +1,8 @@ error: future cannot be sent between threads safely - --> $DIR/issue-68112.rs:34:18 + --> $DIR/issue-68112.rs:34:5 | LL | require_send(send_fut); - | ^^^^^^^^ future created by async block is not `Send` + | ^^^^^^^^^^^^ future created by async block is not `Send` | = help: the trait `Sync` is not implemented for `RefCell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead @@ -18,10 +18,10 @@ 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:43:18 + --> $DIR/issue-68112.rs:43:5 | LL | require_send(send_fut); - | ^^^^^^^^ future created by async block is not `Send` + | ^^^^^^^^^^^^ future created by async block is not `Send` | = help: the trait `Sync` is not implemented for `RefCell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead @@ -37,12 +37,10 @@ LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error[E0277]: `RefCell` cannot be shared between threads safely - --> $DIR/issue-68112.rs:62:18 + --> $DIR/issue-68112.rs:62:5 | LL | require_send(send_fut); - | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^ `RefCell` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `RefCell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead @@ -60,7 +58,7 @@ note: required because it appears within the type `impl Future impl Future>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `ResumeTy`, `impl Future>>`, `()`, `i32`, `Ready` + = note: required because it captures the following types: `impl Future>>`, `Ready` note: required because it's used within this `async` block --> $DIR/issue-68112.rs:57:20 | diff --git a/tests/ui/async-await/issue-70935-complex-spans.rs b/tests/ui/async-await/issue-70935-complex-spans.rs index 33aa89c5a5db5..4af73739584cb 100644 --- a/tests/ui/async-await/issue-70935-complex-spans.rs +++ b/tests/ui/async-await/issue-70935-complex-spans.rs @@ -13,7 +13,7 @@ async fn baz(_c: impl FnMut() -> T) where T: Future { } fn foo(x: NotSync) -> impl Future + Send { - //~^ ERROR future cannot be sent between threads safely + //~^ ERROR `*mut ()` cannot be shared between threads safely async move { baz(|| async { foo(x.clone()); diff --git a/tests/ui/async-await/issue-70935-complex-spans.stderr b/tests/ui/async-await/issue-70935-complex-spans.stderr index 5d8ef77616a8e..ab834daa85dc2 100644 --- a/tests/ui/async-await/issue-70935-complex-spans.stderr +++ b/tests/ui/async-await/issue-70935-complex-spans.stderr @@ -1,21 +1,41 @@ -error: future cannot be sent between threads safely +error[E0277]: `*mut ()` cannot be shared between threads safely --> $DIR/issue-70935-complex-spans.rs:15:23 | LL | fn foo(x: NotSync) -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` + | ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely | = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-70935-complex-spans.rs:20:12 +note: required because it appears within the type `PhantomData<*mut ()>` + --> $SRC_DIR/core/src/marker.rs:LL:COL +note: required because it appears within the type `NotSync` + --> $DIR/issue-70935-complex-spans.rs:9:8 | -LL | baz(|| async { - | _____________- +LL | struct NotSync(PhantomData<*mut ()>); + | ^^^^^^^ + = note: required for `&NotSync` to implement `Send` +note: required because it's used within this closure + --> $DIR/issue-70935-complex-spans.rs:18:13 + | +LL | baz(|| async { + | ^^ +note: required because it's used within this `async fn` body + --> $DIR/issue-70935-complex-spans.rs:12:67 + | +LL | async fn baz(_c: impl FnMut() -> T) where T: Future { + | ___________________________________________________________________^ +LL | | } + | |_^ + = note: required because it captures the following types: `impl Future` +note: required because it's used within this `async` block + --> $DIR/issue-70935-complex-spans.rs:17:5 + | +LL | / async move { +LL | | baz(|| async { LL | | foo(x.clone()); LL | | }).await; - | | - ^^^^^- the value is later dropped here - | | | | - | |_________| await occurs here, with the value maybe used later - | has type `{closure@$DIR/issue-70935-complex-spans.rs:18:13: 18:15}` which is not `Send` +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-71137.stderr b/tests/ui/async-await/issue-71137.stderr index a344246d6bfff..443af010c4a1a 100644 --- a/tests/ui/async-await/issue-71137.stderr +++ b/tests/ui/async-await/issue-71137.stderr @@ -12,9 +12,6 @@ LL | let mut guard = m.lock().unwrap(); | --------- has type `MutexGuard<'_, i32>` which is not `Send` LL | (async { "right"; }).await; | ^^^^^ await occurs here, with `mut guard` maybe used later -LL | *guard += 1; -LL | } - | - `mut guard` is later dropped here note: required by a bound in `fake_spawn` --> $DIR/issue-71137.rs:8:27 | diff --git a/tests/ui/async-await/issue-93197.rs b/tests/ui/async-await/issue-93197.rs index c627fe17afbbe..05ec013d0afd8 100644 --- a/tests/ui/async-await/issue-93197.rs +++ b/tests/ui/async-await/issue-93197.rs @@ -1,7 +1,6 @@ // Regression test for #93197 // check-pass // edition:2021 -// compile-flags: -Zdrop-tracking #![feature(try_blocks)] diff --git a/tests/ui/async-await/issue-93648.rs b/tests/ui/async-await/issue-93648.rs index 4ce3ac1e87460..b27a79a428bd6 100644 --- a/tests/ui/async-await/issue-93648.rs +++ b/tests/ui/async-await/issue-93648.rs @@ -1,6 +1,5 @@ // edition:2021 // build-pass -// compile-flags: -Zdrop-tracking fn main() { let _ = async { diff --git a/tests/ui/async-await/issues/auxiliary/issue_67893.rs b/tests/ui/async-await/issues/auxiliary/issue_67893.rs index 387966a5064fa..efde4d2864d13 100644 --- a/tests/ui/async-await/issues/auxiliary/issue_67893.rs +++ b/tests/ui/async-await/issues/auxiliary/issue_67893.rs @@ -2,9 +2,11 @@ use std::sync::{Arc, Mutex}; +fn make_arc() -> Arc> { unimplemented!() } + pub async fn f(_: ()) {} pub async fn run() { - let x: Arc> = unimplemented!(); + let x: Arc> = make_arc(); f(*x.lock().unwrap()).await; } diff --git a/tests/ui/async-await/issues/issue-107280.rs b/tests/ui/async-await/issues/issue-107280.rs index 85fce87403a9b..81ae9553cf01e 100644 --- a/tests/ui/async-await/issues/issue-107280.rs +++ b/tests/ui/async-await/issues/issue-107280.rs @@ -3,11 +3,6 @@ async fn foo() { inner::().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() {} diff --git a/tests/ui/async-await/issues/issue-107280.stderr b/tests/ui/async-await/issues/issue-107280.stderr index 2e69862a0e09f..c5fd5c5bf0a03 100644 --- a/tests/ui/async-await/issues/issue-107280.stderr +++ b/tests/ui/async-await/issues/issue-107280.stderr @@ -7,7 +7,7 @@ LL | inner::().await | expected 2 generic arguments | note: function defined here, with 2 generic parameters: `T`, `PING` - --> $DIR/issue-107280.rs:13:10 + --> $DIR/issue-107280.rs:8:10 | LL | async fn inner() {} | ^^^^^ - ---------------- @@ -16,67 +16,6 @@ help: add missing generic argument LL | inner::().await | ++++++ -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/issue-107280.rs:4:5 - | -LL | inner::().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:22 - | -LL | inner::().await - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/issue-107280.rs:4:5 - | -LL | inner::().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:22 - | -LL | inner::().await - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/issue-107280.rs:4:5 - | -LL | inner::().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:22 - | -LL | inner::().await - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/issue-107280.rs:4:5 - | -LL | inner::().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:22 - | -LL | inner::().await - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/issue-107280.rs:4:5 - | -LL | inner::().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:22 - | -LL | inner::().await - | ^^^^^ - -error: aborting due to 6 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0107, E0698. -For more information about an error, try `rustc --explain E0107`. +For more information about this error, try `rustc --explain E0107`. 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 a6a45bea897e3..ef6f105f34abb 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,6 +1,5 @@ // edition:2018 // check-pass -// compile-flags: -Zdrop-tracking=yes struct Foo(*const u8); diff --git a/tests/ui/async-await/issues/issue-67893.rs b/tests/ui/async-await/issues/issue-67893.rs index d73772e5fa0d9..359c75f170c39 100644 --- a/tests/ui/async-await/issues/issue-67893.rs +++ b/tests/ui/async-await/issues/issue-67893.rs @@ -7,5 +7,5 @@ fn g(_: impl Send) {} fn main() { g(issue_67893::run()) - //~^ ERROR future cannot be sent between threads safely + //~^ ERROR `MutexGuard<'_, ()>` cannot be sent between threads safely } diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr index e1bea29e9230b..f36269e8f3653 100644 --- a/tests/ui/async-await/issues/issue-67893.stderr +++ b/tests/ui/async-await/issues/issue-67893.stderr @@ -1,18 +1,27 @@ -error: future cannot be sent between threads safely +error[E0277]: `MutexGuard<'_, ()>` cannot be sent between threads safely --> $DIR/issue-67893.rs:9:7 | LL | g(issue_67893::run()) - | ^^^^^^^^^^^^^^^^^^ future is not `Send` + | - ^^^^^^^^^^^^^^^^^^ `MutexGuard<'_, ()>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + ::: $DIR/auxiliary/issue_67893.rs:9:20 + | +LL | pub async fn run() { + | - within this `impl Future` | = help: within `impl Future`, 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:27 + = note: required because it captures the following types: `Arc>`, `MutexGuard<'_, ()>`, `impl Future` +note: required because it's used within this `async fn` body + --> $DIR/auxiliary/issue_67893.rs:9:20 | -LL | f(*x.lock().unwrap()).await; - | ----------------- ^^^^^- `x.lock().unwrap()` is later dropped here - | | | - | | await occurs here, with `x.lock().unwrap()` maybe used later - | has type `MutexGuard<'_, ()>` which is not `Send` +LL | pub async fn run() { + | ____________________^ +LL | | let x: Arc> = make_arc(); +LL | | f(*x.lock().unwrap()).await; +LL | | } + | |_^ note: required by a bound in `g` --> $DIR/issue-67893.rs:6:14 | @@ -21,3 +30,4 @@ LL | fn g(_: impl Send) {} error: aborting due to previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/non-trivial-drop.rs b/tests/ui/async-await/non-trivial-drop.rs index 214e345783b3d..3fed7c972a1a0 100644 --- a/tests/ui/async-await/non-trivial-drop.rs +++ b/tests/ui/async-await/non-trivial-drop.rs @@ -1,6 +1,5 @@ // build-pass // edition:2018 -// compile-flags: -Zdrop-tracking=y #![feature(generators)] diff --git a/tests/ui/async-await/partial-drop-partial-reinit.stderr b/tests/ui/async-await/partial-drop-partial-reinit.stderr index 05f5358340a98..85e1830c78e94 100644 --- a/tests/ui/async-await/partial-drop-partial-reinit.stderr +++ b/tests/ui/async-await/partial-drop-partial-reinit.stderr @@ -11,7 +11,7 @@ LL | async fn foo() { | = help: within `impl Future`, the trait `Send` is not implemented for `NotSend` = note: required because it appears within the type `(NotSend,)` - = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `impl Future`, `()` + = note: required because it captures the following types: `(NotSend,)`, `impl Future` note: required because it's used within this `async fn` body --> $DIR/partial-drop-partial-reinit.rs:28:16 | diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr index 1b847b59eb5b9..77385e966ce2f 100644 --- a/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr +++ b/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr @@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)] = note: see issue #109417 for more information = note: `#[warn(incomplete_features)]` on by default -error: higher-ranked lifetime error +error[E0308]: mismatched types --> $DIR/issue-110963-early.rs:17:5 | LL | / spawn(async move { @@ -16,11 +16,17 @@ LL | | if !hc.check().await { LL | | log_health_check_failure().await; LL | | } LL | | }); - | |______^ + | |______^ one type is more general than the other | - = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send` + = note: expected trait `Send` + found trait `for<'a> Send` +note: the lifetime requirement is introduced here + --> $DIR/issue-110963-early.rs:37:17 + | +LL | F: Future + Send + 'static, + | ^^^^ -error: higher-ranked lifetime error +error[E0308]: mismatched types --> $DIR/issue-110963-early.rs:17:5 | LL | / spawn(async move { @@ -29,9 +35,16 @@ LL | | if !hc.check().await { LL | | log_health_check_failure().await; LL | | } LL | | }); - | |______^ + | |______^ one type is more general than the other + | + = note: expected trait `Send` + found trait `for<'a> Send` +note: the lifetime requirement is introduced here + --> $DIR/issue-110963-early.rs:37:17 | - = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send` +LL | F: Future + Send + 'static, + | ^^^^ error: aborting due to 2 previous errors; 1 warning emitted +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr index 1b847b59eb5b9..77385e966ce2f 100644 --- a/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr +++ b/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr @@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)] = note: see issue #109417 for more information = note: `#[warn(incomplete_features)]` on by default -error: higher-ranked lifetime error +error[E0308]: mismatched types --> $DIR/issue-110963-early.rs:17:5 | LL | / spawn(async move { @@ -16,11 +16,17 @@ LL | | if !hc.check().await { LL | | log_health_check_failure().await; LL | | } LL | | }); - | |______^ + | |______^ one type is more general than the other | - = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send` + = note: expected trait `Send` + found trait `for<'a> Send` +note: the lifetime requirement is introduced here + --> $DIR/issue-110963-early.rs:37:17 + | +LL | F: Future + Send + 'static, + | ^^^^ -error: higher-ranked lifetime error +error[E0308]: mismatched types --> $DIR/issue-110963-early.rs:17:5 | LL | / spawn(async move { @@ -29,9 +35,16 @@ LL | | if !hc.check().await { LL | | log_health_check_failure().await; LL | | } LL | | }); - | |______^ + | |______^ one type is more general than the other + | + = note: expected trait `Send` + found trait `for<'a> Send` +note: the lifetime requirement is introduced here + --> $DIR/issue-110963-early.rs:37:17 | - = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send` +LL | F: Future + Send + 'static, + | ^^^^ error: aborting due to 2 previous errors; 1 warning emitted +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr index 4ca5519c4387a..969094a2c5803 100644 --- a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr +++ b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr @@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)] = note: see issue #109417 for more information = note: `#[warn(incomplete_features)]` on by default -error: higher-ranked lifetime error +error[E0308]: mismatched types --> $DIR/issue-110963-early.rs:15:5 | LL | / spawn(async move { @@ -16,11 +16,17 @@ LL | | if !hc.check().await { LL | | log_health_check_failure().await; LL | | } LL | | }); - | |______^ + | |______^ one type is more general than the other | - = note: could not prove `{async block@$DIR/issue-110963-early.rs:15:11: 20:6}: Send` + = note: expected trait `Send` + found trait `for<'a> Send` +note: the lifetime requirement is introduced here + --> $DIR/issue-110963-early.rs:35:17 + | +LL | F: Future + Send + 'static, + | ^^^^ -error: higher-ranked lifetime error +error[E0308]: mismatched types --> $DIR/issue-110963-early.rs:15:5 | LL | / spawn(async move { @@ -29,9 +35,16 @@ LL | | if !hc.check().await { LL | | log_health_check_failure().await; LL | | } LL | | }); - | |______^ + | |______^ one type is more general than the other + | + = note: expected trait `Send` + found trait `for<'a> Send` +note: the lifetime requirement is introduced here + --> $DIR/issue-110963-early.rs:35:17 | - = note: could not prove `{async block@$DIR/issue-110963-early.rs:15:11: 20:6}: Send` +LL | F: Future + Send + 'static, + | ^^^^ error: aborting due to 2 previous errors; 1 warning emitted +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/unresolved_type_param.rs b/tests/ui/async-await/unresolved_type_param.rs index 6d6d806149104..dd5aa0dd077ae 100644 --- a/tests/ui/async-await/unresolved_type_param.rs +++ b/tests/ui/async-await/unresolved_type_param.rs @@ -2,23 +2,11 @@ // 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() -> () {} 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` + //~^ ERROR type annotations needed } fn main() {} diff --git a/tests/ui/async-await/unresolved_type_param.stderr b/tests/ui/async-await/unresolved_type_param.stderr index ea78c2818c7fe..45aa766065e46 100644 --- a/tests/ui/async-await/unresolved_type_param.stderr +++ b/tests/ui/async-await/unresolved_type_param.stderr @@ -1,39 +1,14 @@ -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:10:5 +error[E0282]: type annotations needed + --> $DIR/unresolved_type_param.rs:9:5 | LL | bar().await; - | ^^^ cannot infer type for type parameter `T` declared on the function `bar` + | ^^^ cannot infer type of the 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:11 +help: consider specifying the generic argument | -LL | bar().await; - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:10: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:11 - | -LL | bar().await; - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:10: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:11 - | -LL | bar().await; - | ^^^^^ +LL | bar::().await; + | +++++ -error: aborting due to 3 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0698`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/borrowck/async-reference-generality.rs b/tests/ui/borrowck/async-reference-generality.rs index 487d1ac81bfc6..668df9ea7101d 100644 --- a/tests/ui/borrowck/async-reference-generality.rs +++ b/tests/ui/borrowck/async-reference-generality.rs @@ -1,5 +1,4 @@ -// check-fail -// known-bug: #99492 +// check-pass // edition: 2021 use std::marker::PhantomData; diff --git a/tests/ui/borrowck/async-reference-generality.stderr b/tests/ui/borrowck/async-reference-generality.stderr deleted file mode 100644 index af720ad29314f..0000000000000 --- a/tests/ui/borrowck/async-reference-generality.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/async-reference-generality.rs:23:5 - | -LL | / async { -LL | | let _x = Struct::, _>(PhantomData); -LL | | async {}.await; -LL | | } - | |_____^ one type is more general than the other - | - = note: expected reference `&()` - found reference `&()` - -error[E0308]: mismatched types - --> $DIR/async-reference-generality.rs:23:5 - | -LL | / async { -LL | | let _x = Struct::, _>(PhantomData); -LL | | async {}.await; -LL | | } - | |_____^ one type is more general than the other - | - = note: expected reference `&()` - found reference `&()` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs b/tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs deleted file mode 100644 index addbe5d658aee..0000000000000 --- a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs +++ /dev/null @@ -1,23 +0,0 @@ -// compile-flags: -Zdrop-tracking-mir -// edition:2021 - -use std::future::Future; - -trait Client { - type Connecting<'a>: Future + Send - where - Self: 'a; - - fn connect(&'_ self) -> Self::Connecting<'a>; - //~^ ERROR use of undeclared lifetime name `'a` -} - -fn call_connect(c: &'_ C) -> impl '_ + Future + Send -where - C: Client + Send + Sync, -{ - async move { c.connect().await } - //~^ ERROR `C` does not live long enough -} - -fn main() {} diff --git a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr b/tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr deleted file mode 100644 index 53abe3dc9521d..0000000000000 --- a/tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/erase-error-in-mir-drop-tracking.rs:11:46 - | -LL | fn connect(&'_ self) -> Self::Connecting<'a>; - | ^^ undeclared lifetime - | -help: consider introducing lifetime `'a` here - | -LL | fn connect<'a>(&'_ self) -> Self::Connecting<'a>; - | ++++ -help: consider introducing lifetime `'a` here - | -LL | trait Client<'a> { - | ++++ - -error: `C` does not live long enough - --> $DIR/erase-error-in-mir-drop-tracking.rs:19:5 - | -LL | async move { c.connect().await } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/codegen/subtyping-enforces-type-equality.stderr b/tests/ui/codegen/subtyping-enforces-type-equality.stderr deleted file mode 100644 index 870ca0f839fee..0000000000000 --- a/tests/ui/codegen/subtyping-enforces-type-equality.stderr +++ /dev/null @@ -1 +0,0 @@ -WARN rustc_codegen_ssa::mir::locals Unexpected initial operand type. See the issues/114858 diff --git a/tests/ui/generator/borrowing.stderr b/tests/ui/generator/borrowing.stderr index 38e1ace8c4efb..03a69fe362313 100644 --- a/tests/ui/generator/borrowing.stderr +++ b/tests/ui/generator/borrowing.stderr @@ -1,16 +1,24 @@ error[E0597]: `a` does not live long enough --> $DIR/borrowing.rs:9:33 | -LL | let _b = { - | -- borrow later stored here -LL | let a = 3; LL | Pin::new(&mut || yield &a).resume(()) - | -- ^ borrowed value does not live long enough - | | + | ----------^ + | | | + | | borrowed value does not live long enough | value captured here by generator + | a temporary with access to the borrow is created here ... LL | LL | }; - | - `a` dropped here while still borrowed + | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator + | | + | `a` dropped here while still borrowed + | + = note: the temporary is part of an expression at the end of a block; + consider forcing this temporary to be dropped sooner, before the block's local variables are dropped +help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block + | +LL | let x = Pin::new(&mut || yield &a).resume(()); x + | +++++++ +++ error[E0597]: `a` does not live long enough --> $DIR/borrowing.rs:16:20 diff --git a/tests/ui/generator/clone-impl.stderr b/tests/ui/generator/clone-impl.stderr index edd3eb7e3da04..870216398b1a1 100644 --- a/tests/ui/generator/clone-impl.stderr +++ b/tests/ui/generator/clone-impl.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `Vec: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:36:23: 36:30}` - --> $DIR/clone-impl.rs:42:16 + --> $DIR/clone-impl.rs:42:5 | LL | let gen_clone_0 = move || { | ------- within this `{generator@$DIR/clone-impl.rs:36:23: 36:30}` ... LL | check_copy(&gen_clone_0); - | ^^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec` + | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec` | note: captured value does not implement `Copy` --> $DIR/clone-impl.rs:40:14 @@ -19,13 +19,13 @@ LL | fn check_copy(_x: &T) {} | ^^^^ required by this bound in `check_copy` error[E0277]: the trait bound `Vec: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:36:23: 36:30}` - --> $DIR/clone-impl.rs:42:16 + --> $DIR/clone-impl.rs:42:5 | LL | let gen_clone_0 = move || { | ------- within this `{generator@$DIR/clone-impl.rs:36:23: 36:30}` ... LL | check_copy(&gen_clone_0); - | ^^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec` + | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec` | note: generator does not implement `Copy` as this value is used across a yield --> $DIR/clone-impl.rs:38:9 @@ -34,9 +34,6 @@ LL | let v = vec!['a']; | - has type `Vec` which does not implement `Copy` LL | yield; | ^^^^^ yield occurs here, with `v` maybe used later -... -LL | }; - | - `v` is later dropped here note: required by a bound in `check_copy` --> $DIR/clone-impl.rs:72:18 | @@ -44,13 +41,13 @@ LL | fn check_copy(_x: &T) {} | ^^^^ required by this bound in `check_copy` error[E0277]: the trait bound `Vec: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}` - --> $DIR/clone-impl.rs:58:16 + --> $DIR/clone-impl.rs:58:5 | LL | let gen_clone_1 = move || { | ------- within this `{generator@$DIR/clone-impl.rs:46:23: 46:30}` ... LL | check_copy(&gen_clone_1); - | ^^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec` + | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec` | note: captured value does not implement `Copy` --> $DIR/clone-impl.rs:56:14 @@ -64,13 +61,13 @@ LL | fn check_copy(_x: &T) {} | ^^^^ required by this bound in `check_copy` error[E0277]: the trait bound `Vec: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}` - --> $DIR/clone-impl.rs:58:16 + --> $DIR/clone-impl.rs:58:5 | LL | let gen_clone_1 = move || { | ------- within this `{generator@$DIR/clone-impl.rs:46:23: 46:30}` ... LL | check_copy(&gen_clone_1); - | ^^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec` + | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec` | note: generator does not implement `Copy` as this value is used across a yield --> $DIR/clone-impl.rs:52:9 @@ -80,9 +77,6 @@ LL | let v = vec!['a']; ... LL | yield; | ^^^^^ yield occurs here, with `v` maybe used later -... -LL | }; - | - `v` is later dropped here note: required by a bound in `check_copy` --> $DIR/clone-impl.rs:72:18 | @@ -90,13 +84,13 @@ LL | fn check_copy(_x: &T) {} | ^^^^ required by this bound in `check_copy` error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}` - --> $DIR/clone-impl.rs:66:16 + --> $DIR/clone-impl.rs:66:5 | LL | let gen_non_clone = move || { | ------- within this `{generator@$DIR/clone-impl.rs:62:25: 62:32}` ... LL | check_copy(&gen_non_clone); - | ^^^^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Copy` is not implemented for `NonClone` + | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Copy` is not implemented for `NonClone` | note: captured value does not implement `Copy` --> $DIR/clone-impl.rs:64:14 @@ -115,13 +109,13 @@ LL | struct NonClone; | error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}` - --> $DIR/clone-impl.rs:68:17 + --> $DIR/clone-impl.rs:68:5 | LL | let gen_non_clone = move || { | ------- within this `{generator@$DIR/clone-impl.rs:62:25: 62:32}` ... LL | check_clone(&gen_non_clone); - | ^^^^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Clone` is not implemented for `NonClone` + | ^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Clone` is not implemented for `NonClone` | note: captured value does not implement `Clone` --> $DIR/clone-impl.rs:64:14 diff --git a/tests/ui/generator/derived-drop-parent-expr.rs b/tests/ui/generator/derived-drop-parent-expr.rs index 4bd34346a1815..e381924517d35 100644 --- a/tests/ui/generator/derived-drop-parent-expr.rs +++ b/tests/ui/generator/derived-drop-parent-expr.rs @@ -1,5 +1,4 @@ // build-pass -// compile-flags:-Zdrop-tracking //! Like drop-tracking-parent-expression, but also tests that this doesn't ICE when building MIR #![feature(generators)] diff --git a/tests/ui/generator/drop-control-flow.rs b/tests/ui/generator/drop-control-flow.rs index c6efda9541fb1..1c25c06ba4ccf 100644 --- a/tests/ui/generator/drop-control-flow.rs +++ b/tests/ui/generator/drop-control-flow.rs @@ -1,5 +1,4 @@ // build-pass -// compile-flags: -Zdrop-tracking // A test to ensure generators capture values that were conditionally dropped, // and also that values that are dropped along all paths to a yield do not get diff --git a/tests/ui/generator/drop-track-addassign-yield.rs b/tests/ui/generator/drop-track-addassign-yield.rs index 71cfb170bf6aa..1e64f1d2ec736 100644 --- a/tests/ui/generator/drop-track-addassign-yield.rs +++ b/tests/ui/generator/drop-track-addassign-yield.rs @@ -1,5 +1,4 @@ // run-pass -// compile-flags: -Zdrop-tracking // Based on addassign-yield.rs, but with drop tracking enabled. Originally we did not implement // the fake_read callback on ExprUseVisitor which caused this case to break. diff --git a/tests/ui/generator/drop-tracking-error-body.rs b/tests/ui/generator/drop-tracking-error-body.rs deleted file mode 100644 index f99d9ab6bf860..0000000000000 --- a/tests/ui/generator/drop-tracking-error-body.rs +++ /dev/null @@ -1,18 +0,0 @@ -// compile-flags: -Zdrop-tracking-mir --edition=2021 - -#![feature(generators)] - -pub async fn async_bad_body() { - match true {} //~ ERROR non-exhaustive patterns: type `bool` is non-empty -} - -pub fn generator_bad_body() { - || { - // 'non-exhaustive pattern' only seems to be reported once, so this annotation doesn't work - // keep the function around so we can make sure it doesn't ICE - match true {}; // ERROR non-exhaustive patterns: type `bool` is non-empty - yield (); - }; -} - -fn main() {} diff --git a/tests/ui/generator/drop-tracking-error-body.stderr b/tests/ui/generator/drop-tracking-error-body.stderr deleted file mode 100644 index 28a6892336ff2..0000000000000 --- a/tests/ui/generator/drop-tracking-error-body.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0004]: non-exhaustive patterns: type `bool` is non-empty - --> $DIR/drop-tracking-error-body.rs:6:11 - | -LL | match true {} - | ^^^^ - | - = note: the matched value is of type `bool` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown - | -LL ~ match true { -LL + _ => todo!(), -LL ~ } - | - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0004`. diff --git a/tests/ui/generator/drop-tracking-parent-expression.rs b/tests/ui/generator/drop-tracking-parent-expression.rs index d40f1b8f64d4a..198b14528aad5 100644 --- a/tests/ui/generator/drop-tracking-parent-expression.rs +++ b/tests/ui/generator/drop-tracking-parent-expression.rs @@ -1,4 +1,3 @@ -// compile-flags: -Zdrop-tracking #![feature(generators, negative_impls, rustc_attrs)] macro_rules! type_combinations { diff --git a/tests/ui/generator/drop-tracking-parent-expression.stderr b/tests/ui/generator/drop-tracking-parent-expression.stderr index 6119f689731ce..e85bb1347a798 100644 --- a/tests/ui/generator/drop-tracking-parent-expression.stderr +++ b/tests/ui/generator/drop-tracking-parent-expression.stderr @@ -1,8 +1,8 @@ error: generator cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:24:25 + --> $DIR/drop-tracking-parent-expression.rs:23:13 | LL | assert_send(g); - | ^ generator is not `Send` + | ^^^^^^^^^^^ generator is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -13,17 +13,15 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:18:21: 18:28}`, the trait `Send` is not implemented for `derived_drop::Client` + = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client` note: generator is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:22:22 + --> $DIR/drop-tracking-parent-expression.rs:21:22 | LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { | ------------------------ has type `derived_drop::Client` which is not `Send` ... LL | _ => yield, | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -LL | }; - | - `$name::Client::default()` is later dropped here ... LL | / type_combinations!( LL | | // OK @@ -34,17 +32,17 @@ LL | | }; LL | | ); | |_____- in this macro invocation note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:41:19 + --> $DIR/drop-tracking-parent-expression.rs:40:19 | LL | fn assert_send(_thing: T) {} | ^^^^ required by this bound in `assert_send` = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) error: generator cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:24:25 + --> $DIR/drop-tracking-parent-expression.rs:23:13 | LL | assert_send(g); - | ^ generator is not `Send` + | ^^^^^^^^^^^ generator is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -55,17 +53,15 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:18:21: 18:28}`, the trait `Send` is not implemented for `significant_drop::Client` + = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client` note: generator is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:22:22 + --> $DIR/drop-tracking-parent-expression.rs:21:22 | LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { | ------------------------ has type `significant_drop::Client` which is not `Send` ... LL | _ => yield, | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -LL | }; - | - `$name::Client::default()` is later dropped here ... LL | / type_combinations!( LL | | // OK @@ -76,17 +72,17 @@ LL | | }; LL | | ); | |_____- in this macro invocation note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:41:19 + --> $DIR/drop-tracking-parent-expression.rs:40:19 | LL | fn assert_send(_thing: T) {} | ^^^^ required by this bound in `assert_send` = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) error: generator cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:24:25 + --> $DIR/drop-tracking-parent-expression.rs:23:13 | LL | assert_send(g); - | ^ generator is not `Send` + | ^^^^^^^^^^^ generator is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -97,17 +93,15 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:18:21: 18:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client` + = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client` note: generator is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:22:22 + --> $DIR/drop-tracking-parent-expression.rs:21:22 | LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { | ------------------------ has type `insignificant_dtor::Client` which is not `Send` ... LL | _ => yield, | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -LL | }; - | - `$name::Client::default()` is later dropped here ... LL | / type_combinations!( LL | | // OK @@ -118,7 +112,7 @@ LL | | }; LL | | ); | |_____- in this macro invocation note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:41:19 + --> $DIR/drop-tracking-parent-expression.rs:40:19 | LL | fn assert_send(_thing: T) {} | ^^^^ required by this bound in `assert_send` diff --git a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs b/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs index 646365e435901..92e0136d51b15 100644 --- a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs +++ b/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs @@ -1,6 +1,5 @@ // build-pass // edition:2018 -// compile-flags: -Zdrop-tracking #![feature(generators)] diff --git a/tests/ui/generator/drop-yield-twice.stderr b/tests/ui/generator/drop-yield-twice.stderr index 6a28e463189b0..39a906f0bf4c0 100644 --- a/tests/ui/generator/drop-yield-twice.stderr +++ b/tests/ui/generator/drop-yield-twice.stderr @@ -1,14 +1,8 @@ error: generator cannot be sent between threads safely - --> $DIR/drop-yield-twice.rs:7:17 + --> $DIR/drop-yield-twice.rs:7:5 | -LL | assert_send(|| { - | _________________^ -LL | | let guard = Foo(42); -LL | | yield; -LL | | drop(guard); -LL | | yield; -LL | | }) - | |_____^ generator is not `Send` +LL | assert_send(|| { + | ^^^^^^^^^^^ generator is not `Send` | = help: within `{generator@$DIR/drop-yield-twice.rs:7:17: 7:19}`, the trait `Send` is not implemented for `Foo` note: generator is not `Send` as this value is used across a yield @@ -18,9 +12,6 @@ LL | let guard = Foo(42); | ----- has type `Foo` which is not `Send` LL | yield; | ^^^^^ yield occurs here, with `guard` maybe used later -... -LL | }) - | - `guard` is later dropped here note: required by a bound in `assert_send` --> $DIR/drop-yield-twice.rs:15:19 | diff --git a/tests/ui/generator/issue-102645.rs b/tests/ui/generator/issue-102645.rs index 35acd5cd727c2..677cc69d3f2db 100644 --- a/tests/ui/generator/issue-102645.rs +++ b/tests/ui/generator/issue-102645.rs @@ -1,5 +1,3 @@ -// compile-flags: -Zdrop-tracking - #![feature(generators, generator_trait)] use std::ops::Generator; diff --git a/tests/ui/generator/issue-102645.stderr b/tests/ui/generator/issue-102645.stderr index 3f9a4c2f3c507..5d28dfc45b313 100644 --- a/tests/ui/generator/issue-102645.stderr +++ b/tests/ui/generator/issue-102645.stderr @@ -1,5 +1,5 @@ error[E0061]: this method takes 1 argument but 0 arguments were supplied - --> $DIR/issue-102645.rs:16:22 + --> $DIR/issue-102645.rs:14:22 | LL | Pin::new(&mut b).resume(); | ^^^^^^-- an argument of type `()` is missing diff --git a/tests/ui/generator/issue-105084.rs b/tests/ui/generator/issue-105084.rs index 9fdeb4fd2fc06..50b5da6e6adfd 100644 --- a/tests/ui/generator/issue-105084.rs +++ b/tests/ui/generator/issue-105084.rs @@ -1,5 +1,3 @@ -// compile-flags: -Zdrop-tracking-mir - #![feature(generators)] #![feature(generator_clone)] #![feature(generator_trait)] diff --git a/tests/ui/generator/issue-105084.stderr b/tests/ui/generator/issue-105084.stderr index 3f1f11918f509..573c31f113402 100644 --- a/tests/ui/generator/issue-105084.stderr +++ b/tests/ui/generator/issue-105084.stderr @@ -1,8 +1,8 @@ error[E0382]: borrow of moved value: `g` - --> $DIR/issue-105084.rs:39:14 + --> $DIR/issue-105084.rs:37:14 | LL | let mut g = || { - | ----- move occurs because `g` has type `{generator@$DIR/issue-105084.rs:16:17: 16:19}`, which does not implement the `Copy` trait + | ----- move occurs because `g` has type `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, which does not implement the `Copy` trait ... LL | let mut h = copy(g); | - value moved here @@ -11,7 +11,7 @@ LL | Pin::new(&mut g).resume(()); | ^^^^^^ value borrowed here after move | note: consider changing this parameter type in function `copy` to borrow instead if owning the value isn't necessary - --> $DIR/issue-105084.rs:11:21 + --> $DIR/issue-105084.rs:9:21 | LL | fn copy(x: T) -> T { | ---- ^ this parameter takes ownership of the value @@ -22,17 +22,17 @@ help: consider cloning the value if the performance cost is acceptable LL | let mut h = copy(g.clone()); | ++++++++ -error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{generator@$DIR/issue-105084.rs:16:17: 16:19}` - --> $DIR/issue-105084.rs:33:17 +error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{generator@$DIR/issue-105084.rs:14:17: 14:19}` + --> $DIR/issue-105084.rs:31:17 | LL | let mut g = || { - | -- within this `{generator@$DIR/issue-105084.rs:16:17: 16:19}` + | -- within this `{generator@$DIR/issue-105084.rs:14:17: 14:19}` ... LL | let mut h = copy(g); - | ^^^^ within `{generator@$DIR/issue-105084.rs:16:17: 16:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>` + | ^^^^ within `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>` | note: generator does not implement `Copy` as this value is used across a yield - --> $DIR/issue-105084.rs:23:22 + --> $DIR/issue-105084.rs:21:22 | LL | Box::new((5, yield)); | -------------^^^^^-- @@ -40,7 +40,7 @@ LL | Box::new((5, yield)); | | yield occurs here, with `Box::new((5, yield))` maybe used later | has type `Box<(i32, ())>` which does not implement `Copy` note: required by a bound in `copy` - --> $DIR/issue-105084.rs:11:12 + --> $DIR/issue-105084.rs:9:12 | LL | fn copy(x: T) -> T { | ^^^^ required by this bound in `copy` diff --git a/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs b/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs index 9408acc15f965..a45479e5300d8 100644 --- a/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs +++ b/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs @@ -1,5 +1,4 @@ // edition:2021 -// compile-flags: -Zdrop-tracking-mir=yes #![feature(generators)] fn main() { diff --git a/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr b/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr index 4d72ebe79eb49..66f0e3d94bdab 100644 --- a/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr +++ b/tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/issue-110929-generator-conflict-error-ice.rs:9:9 + --> $DIR/issue-110929-generator-conflict-error-ice.rs:8:9 | LL | let _c = || yield *&mut *x; | -- -- first borrow occurs due to use of `*x` in generator diff --git a/tests/ui/generator/issue-57017.rs b/tests/ui/generator/issue-57017.rs index 6cb742b7ffe01..bb2d6679b6763 100644 --- a/tests/ui/generator/issue-57017.rs +++ b/tests/ui/generator/issue-57017.rs @@ -1,5 +1,4 @@ // build-pass -// compile-flags: -Zdrop-tracking #![feature(generators, negative_impls)] #![allow(dropping_references, dropping_copy_types)] diff --git a/tests/ui/generator/issue-57478.rs b/tests/ui/generator/issue-57478.rs index 91407ea1844f5..39710febdb95c 100644 --- a/tests/ui/generator/issue-57478.rs +++ b/tests/ui/generator/issue-57478.rs @@ -1,5 +1,4 @@ // check-pass -// compile-flags: -Zdrop-tracking #![feature(negative_impls, generators)] diff --git a/tests/ui/generator/issue-68112.rs b/tests/ui/generator/issue-68112.rs index 9def544e3d25c..9dd68726f9288 100644 --- a/tests/ui/generator/issue-68112.rs +++ b/tests/ui/generator/issue-68112.rs @@ -8,7 +8,7 @@ use std::{ }; pub struct Ready(Option); -impl Generator<()> for Ready { +impl Generator<()> for Ready { type Return = T; type Yield = (); fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> { @@ -36,7 +36,7 @@ fn test1() { yield; //~^ NOTE yield occurs here //~| NOTE value is used across a yield - }; //~ NOTE later dropped here + }; require_send(send_gen); //~^ ERROR generator cannot be sent between threads //~| NOTE not `Send` @@ -65,7 +65,6 @@ fn test2() { //~^ ERROR `RefCell` cannot be shared between threads safely //~| NOTE `RefCell` cannot be shared between threads safely //~| NOTE required for - //~| NOTE required by a bound introduced by this call //~| NOTE captures the following types //~| NOTE use `std::sync::RwLock` instead } diff --git a/tests/ui/generator/issue-68112.stderr b/tests/ui/generator/issue-68112.stderr index b42bc93d01f66..8080048222ffb 100644 --- a/tests/ui/generator/issue-68112.stderr +++ b/tests/ui/generator/issue-68112.stderr @@ -1,8 +1,8 @@ error: generator cannot be sent between threads safely - --> $DIR/issue-68112.rs:40:18 + --> $DIR/issue-68112.rs:40:5 | LL | require_send(send_gen); - | ^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^^ generator is not `Send` | = help: the trait `Sync` is not implemented for `RefCell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead @@ -14,9 +14,6 @@ LL | let _non_send_gen = make_non_send_generator(); LL | LL | yield; | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later -... -LL | }; - | - `_non_send_gen` is later dropped here note: required by a bound in `require_send` --> $DIR/issue-68112.rs:22:25 | @@ -24,12 +21,10 @@ LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error[E0277]: `RefCell` cannot be shared between threads safely - --> $DIR/issue-68112.rs:64:18 + --> $DIR/issue-68112.rs:64:5 | LL | require_send(send_gen); - | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^ `RefCell` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `RefCell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead @@ -49,7 +44,7 @@ note: required because it appears within the type `impl Generator impl Generator>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `impl Generator>>`, `()` + = note: required because it captures the following types: `impl Generator>>` note: required because it's used within this generator --> $DIR/issue-68112.rs:60:20 | diff --git a/tests/ui/generator/issue-93161.rs b/tests/ui/generator/issue-93161.rs index 92305609c835c..ae8603b7c09fa 100644 --- a/tests/ui/generator/issue-93161.rs +++ b/tests/ui/generator/issue-93161.rs @@ -1,6 +1,5 @@ // edition:2021 // run-pass -// compile-flags: -Zdrop-tracking #![feature(never_type)] diff --git a/tests/ui/generator/not-send-sync.rs b/tests/ui/generator/not-send-sync.rs index 8ca5565fb2ab5..16c8cd476291c 100644 --- a/tests/ui/generator/not-send-sync.rs +++ b/tests/ui/generator/not-send-sync.rs @@ -1,6 +1,11 @@ #![feature(generators)] +#![feature(negative_impls)] -use std::cell::Cell; +struct NotSend; +struct NotSync; + +impl !Send for NotSend {} +impl !Sync for NotSync {} fn main() { fn assert_sync(_: T) {} @@ -8,14 +13,15 @@ fn main() { assert_sync(|| { //~^ ERROR: generator cannot be shared between threads safely - let a = Cell::new(2); + let a = NotSync; yield; + drop(a); }); - let a = Cell::new(2); assert_send(|| { - //~^ ERROR: E0277 - drop(&a); + //~^ ERROR: generator cannot be sent between threads safely + let a = NotSend; yield; + drop(a); }); } diff --git a/tests/ui/generator/not-send-sync.stderr b/tests/ui/generator/not-send-sync.stderr index 6e0269026b569..13ce687e0bb45 100644 --- a/tests/ui/generator/not-send-sync.stderr +++ b/tests/ui/generator/not-send-sync.stderr @@ -1,58 +1,42 @@ -error[E0277]: `Cell` cannot be shared between threads safely - --> $DIR/not-send-sync.rs:16:17 - | -LL | assert_send(|| { - | _____-----------_^ - | | | - | | required by a bound introduced by this call -LL | | -LL | | drop(&a); -LL | | yield; -LL | | }); - | |_____^ `Cell` cannot be shared between threads safely - | - = help: the trait `Sync` is not implemented for `Cell` - = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead - = note: required for `&Cell` to implement `Send` -note: required because it's used within this generator - --> $DIR/not-send-sync.rs:16:17 +error: generator cannot be shared between threads safely + --> $DIR/not-send-sync.rs:14:5 | -LL | assert_send(|| { - | ^^ -note: required by a bound in `assert_send` - --> $DIR/not-send-sync.rs:7:23 +LL | assert_sync(|| { + | ^^^^^^^^^^^ generator is not `Sync` | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: generator cannot be shared between threads safely - --> $DIR/not-send-sync.rs:9:17 - | -LL | assert_sync(|| { - | _________________^ -LL | | -LL | | let a = Cell::new(2); -LL | | yield; -LL | | }); - | |_____^ generator is not `Sync` - | - = help: within `{generator@$DIR/not-send-sync.rs:9:17: 9:19}`, the trait `Sync` is not implemented for `Cell` - = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead + = help: within `{generator@$DIR/not-send-sync.rs:14:17: 14:19}`, the trait `Sync` is not implemented for `NotSync` note: generator is not `Sync` as this value is used across a yield - --> $DIR/not-send-sync.rs:12:9 + --> $DIR/not-send-sync.rs:17:9 | -LL | let a = Cell::new(2); - | - has type `Cell` which is not `Sync` +LL | let a = NotSync; + | - has type `NotSync` which is not `Sync` LL | yield; | ^^^^^ yield occurs here, with `a` maybe used later -LL | }); - | - `a` is later dropped here note: required by a bound in `assert_sync` - --> $DIR/not-send-sync.rs:6:23 + --> $DIR/not-send-sync.rs:11:23 | LL | fn assert_sync(_: T) {} | ^^^^ required by this bound in `assert_sync` +error: generator cannot be sent between threads safely + --> $DIR/not-send-sync.rs:21:5 + | +LL | assert_send(|| { + | ^^^^^^^^^^^ generator is not `Send` + | + = help: within `{generator@$DIR/not-send-sync.rs:21:17: 21:19}`, the trait `Send` is not implemented for `NotSend` +note: generator is not `Send` as this value is used across a yield + --> $DIR/not-send-sync.rs:24:9 + | +LL | let a = NotSend; + | - has type `NotSend` which is not `Send` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +note: required by a bound in `assert_send` + --> $DIR/not-send-sync.rs:12:23 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/parent-expression.rs b/tests/ui/generator/parent-expression.rs index 47a179c14ad42..198b14528aad5 100644 --- a/tests/ui/generator/parent-expression.rs +++ b/tests/ui/generator/parent-expression.rs @@ -1,5 +1,3 @@ -// compile-flags: -Zdrop-tracking - #![feature(generators, negative_impls, rustc_attrs)] macro_rules! type_combinations { diff --git a/tests/ui/generator/parent-expression.stderr b/tests/ui/generator/parent-expression.stderr index 5fb54abeb2d7b..25a3b051b1f0a 100644 --- a/tests/ui/generator/parent-expression.stderr +++ b/tests/ui/generator/parent-expression.stderr @@ -1,8 +1,8 @@ error: generator cannot be sent between threads safely - --> $DIR/parent-expression.rs:25:25 + --> $DIR/parent-expression.rs:23:13 | LL | assert_send(g); - | ^ generator is not `Send` + | ^^^^^^^^^^^ generator is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -13,17 +13,15 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{generator@$DIR/parent-expression.rs:19:21: 19:28}`, the trait `Send` is not implemented for `derived_drop::Client` + = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client` note: generator is not `Send` as this value is used across a yield - --> $DIR/parent-expression.rs:23:22 + --> $DIR/parent-expression.rs:21:22 | LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { | ------------------------ has type `derived_drop::Client` which is not `Send` ... LL | _ => yield, | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -LL | }; - | - `$name::Client::default()` is later dropped here ... LL | / type_combinations!( LL | | // OK @@ -34,17 +32,17 @@ LL | | }; LL | | ); | |_____- in this macro invocation note: required by a bound in `assert_send` - --> $DIR/parent-expression.rs:42:19 + --> $DIR/parent-expression.rs:40:19 | LL | fn assert_send(_thing: T) {} | ^^^^ required by this bound in `assert_send` = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) error: generator cannot be sent between threads safely - --> $DIR/parent-expression.rs:25:25 + --> $DIR/parent-expression.rs:23:13 | LL | assert_send(g); - | ^ generator is not `Send` + | ^^^^^^^^^^^ generator is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -55,17 +53,15 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{generator@$DIR/parent-expression.rs:19:21: 19:28}`, the trait `Send` is not implemented for `significant_drop::Client` + = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client` note: generator is not `Send` as this value is used across a yield - --> $DIR/parent-expression.rs:23:22 + --> $DIR/parent-expression.rs:21:22 | LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { | ------------------------ has type `significant_drop::Client` which is not `Send` ... LL | _ => yield, | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -LL | }; - | - `$name::Client::default()` is later dropped here ... LL | / type_combinations!( LL | | // OK @@ -76,17 +72,17 @@ LL | | }; LL | | ); | |_____- in this macro invocation note: required by a bound in `assert_send` - --> $DIR/parent-expression.rs:42:19 + --> $DIR/parent-expression.rs:40:19 | LL | fn assert_send(_thing: T) {} | ^^^^ required by this bound in `assert_send` = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) error: generator cannot be sent between threads safely - --> $DIR/parent-expression.rs:25:25 + --> $DIR/parent-expression.rs:23:13 | LL | assert_send(g); - | ^ generator is not `Send` + | ^^^^^^^^^^^ generator is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -97,17 +93,15 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{generator@$DIR/parent-expression.rs:19:21: 19:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client` + = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client` note: generator is not `Send` as this value is used across a yield - --> $DIR/parent-expression.rs:23:22 + --> $DIR/parent-expression.rs:21:22 | LL | let g = move || match drop($name::Client { ..$name::Client::default() }) { | ------------------------ has type `insignificant_dtor::Client` which is not `Send` ... LL | _ => yield, | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -LL | }; - | - `$name::Client::default()` is later dropped here ... LL | / type_combinations!( LL | | // OK @@ -118,7 +112,7 @@ LL | | }; LL | | ); | |_____- in this macro invocation note: required by a bound in `assert_send` - --> $DIR/parent-expression.rs:42:19 + --> $DIR/parent-expression.rs:40:19 | LL | fn assert_send(_thing: T) {} | ^^^^ required by this bound in `assert_send` diff --git a/tests/ui/generator/partial-drop.rs b/tests/ui/generator/partial-drop.rs index c872fb7f3e630..868f36adce2c2 100644 --- a/tests/ui/generator/partial-drop.rs +++ b/tests/ui/generator/partial-drop.rs @@ -1,5 +1,4 @@ -// compile-flags: -Zdrop-tracking - +// check-pass #![feature(negative_impls, generators)] struct Foo; @@ -12,26 +11,19 @@ struct Bar { fn main() { assert_send(|| { - //~^ ERROR generator cannot be sent between threads safely - // FIXME: it would be nice to make this work. let guard = Bar { foo: Foo, x: 42 }; drop(guard.foo); yield; }); assert_send(|| { - //~^ ERROR generator cannot be sent between threads safely - // FIXME: it would be nice to make this work. - let guard = Bar { foo: Foo, x: 42 }; + let mut guard = Bar { foo: Foo, x: 42 }; drop(guard); - guard.foo = Foo; - guard.x = 23; + guard = Bar { foo: Foo, x: 23 }; yield; }); assert_send(|| { - //~^ ERROR generator cannot be sent between threads safely - // FIXME: it would be nice to make this work. let guard = Bar { foo: Foo, x: 42 }; let Bar { foo, x } = guard; drop(foo); diff --git a/tests/ui/generator/partial-drop.stderr b/tests/ui/generator/partial-drop.stderr deleted file mode 100644 index f374b549df33c..0000000000000 --- a/tests/ui/generator/partial-drop.stderr +++ /dev/null @@ -1,92 +0,0 @@ -error: generator cannot be sent between threads safely - --> $DIR/partial-drop.rs:14:17 - | -LL | assert_send(|| { - | _________________^ -LL | | -LL | | // FIXME: it would be nice to make this work. -LL | | let guard = Bar { foo: Foo, x: 42 }; -LL | | drop(guard.foo); -LL | | yield; -LL | | }); - | |_____^ generator is not `Send` - | - = help: within `{generator@$DIR/partial-drop.rs:14:17: 14:19}`, the trait `Send` is not implemented for `Foo` -note: generator is not `Send` as this value is used across a yield - --> $DIR/partial-drop.rs:19:9 - | -LL | let guard = Bar { foo: Foo, x: 42 }; - | ----- has type `Bar` which is not `Send` -LL | drop(guard.foo); -LL | yield; - | ^^^^^ yield occurs here, with `guard` maybe used later -LL | }); - | - `guard` is later dropped here -note: required by a bound in `assert_send` - --> $DIR/partial-drop.rs:42:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: generator cannot be sent between threads safely - --> $DIR/partial-drop.rs:22:17 - | -LL | assert_send(|| { - | _________________^ -LL | | -LL | | // FIXME: it would be nice to make this work. -LL | | let guard = Bar { foo: Foo, x: 42 }; -... | -LL | | yield; -LL | | }); - | |_____^ generator is not `Send` - | - = help: within `{generator@$DIR/partial-drop.rs:22:17: 22:19}`, the trait `Send` is not implemented for `Foo` -note: generator is not `Send` as this value is used across a yield - --> $DIR/partial-drop.rs:29:9 - | -LL | let guard = Bar { foo: Foo, x: 42 }; - | ----- has type `Bar` which is not `Send` -... -LL | yield; - | ^^^^^ yield occurs here, with `guard` maybe used later -LL | }); - | - `guard` is later dropped here -note: required by a bound in `assert_send` - --> $DIR/partial-drop.rs:42:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: generator cannot be sent between threads safely - --> $DIR/partial-drop.rs:32:17 - | -LL | assert_send(|| { - | _________________^ -LL | | -LL | | // FIXME: it would be nice to make this work. -LL | | let guard = Bar { foo: Foo, x: 42 }; -... | -LL | | yield; -LL | | }); - | |_____^ generator is not `Send` - | - = help: within `{generator@$DIR/partial-drop.rs:32:17: 32:19}`, the trait `Send` is not implemented for `Foo` -note: generator is not `Send` as this value is used across a yield - --> $DIR/partial-drop.rs:38:9 - | -LL | let guard = Bar { foo: Foo, x: 42 }; - | ----- has type `Bar` which is not `Send` -... -LL | yield; - | ^^^^^ yield occurs here, with `guard` maybe used later -LL | }); - | - `guard` is later dropped here -note: required by a bound in `assert_send` - --> $DIR/partial-drop.rs:42:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: aborting due to 3 previous errors - diff --git a/tests/ui/generator/print/generator-print-verbose-1.rs b/tests/ui/generator/print/generator-print-verbose-1.rs index 89124ad7289ac..e52234c08a352 100644 --- a/tests/ui/generator/print/generator-print-verbose-1.rs +++ b/tests/ui/generator/print/generator-print-verbose-1.rs @@ -12,7 +12,7 @@ use std::{ }; pub struct Ready(Option); -impl Generator<()> for Ready { +impl Generator<()> for Ready { type Return = T; type Yield = (); fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> { diff --git a/tests/ui/generator/print/generator-print-verbose-1.stderr b/tests/ui/generator/print/generator-print-verbose-1.stderr index 1e409534c758f..d949543de41bc 100644 --- a/tests/ui/generator/print/generator-print-verbose-1.stderr +++ b/tests/ui/generator/print/generator-print-verbose-1.stderr @@ -1,8 +1,8 @@ error: generator cannot be sent between threads safely - --> $DIR/generator-print-verbose-1.rs:37:18 + --> $DIR/generator-print-verbose-1.rs:37:5 | LL | require_send(send_gen); - | ^^^^^^^^ generator is not `Send` + | ^^^^^^^^^^^^ generator is not `Send` | = help: the trait `Sync` is not implemented for `RefCell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead @@ -13,8 +13,6 @@ LL | let _non_send_gen = make_non_send_generator(); | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[7d1d]::make_non_send_generator::{opaque#0}), [])` which is not `Send` LL | yield; | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later -LL | }; - | - `_non_send_gen` is later dropped here note: required by a bound in `require_send` --> $DIR/generator-print-verbose-1.rs:26:25 | @@ -22,12 +20,10 @@ LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error[E0277]: `RefCell` cannot be shared between threads safely - --> $DIR/generator-print-verbose-1.rs:56:18 + --> $DIR/generator-print-verbose-1.rs:56:5 | LL | require_send(send_gen); - | ------------ ^^^^^^^^ `RefCell` cannot be shared between threads safely - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^ `RefCell` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `RefCell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead @@ -47,7 +43,7 @@ note: required because it appears within the type `Opaque(DefId(0:36 ~ generator | LL | fn make_non_send_generator2() -> impl Generator>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`, `()` + = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])` note: required because it's used within this generator --> $DIR/generator-print-verbose-1.rs:52:20 | diff --git a/tests/ui/generator/print/generator-print-verbose-2.rs b/tests/ui/generator/print/generator-print-verbose-2.rs index d914719cb36bb..e53a7ef8cc137 100644 --- a/tests/ui/generator/print/generator-print-verbose-2.rs +++ b/tests/ui/generator/print/generator-print-verbose-2.rs @@ -2,8 +2,13 @@ // Same as test/ui/generator/not-send-sync.rs #![feature(generators)] +#![feature(negative_impls)] -use std::cell::Cell; +struct NotSend; +struct NotSync; + +impl !Send for NotSend {} +impl !Sync for NotSync {} fn main() { fn assert_sync(_: T) {} @@ -11,14 +16,15 @@ fn main() { assert_sync(|| { //~^ ERROR: generator cannot be shared between threads safely - let a = Cell::new(2); + let a = NotSync; yield; + drop(a); }); - let a = Cell::new(2); assert_send(|| { - //~^ ERROR: E0277 - drop(&a); + //~^ ERROR: generator cannot be sent between threads safely + let a = NotSend; yield; + drop(a); }); } diff --git a/tests/ui/generator/print/generator-print-verbose-2.stderr b/tests/ui/generator/print/generator-print-verbose-2.stderr index 4e88e73f1d6df..8ff7557619fee 100644 --- a/tests/ui/generator/print/generator-print-verbose-2.stderr +++ b/tests/ui/generator/print/generator-print-verbose-2.stderr @@ -1,58 +1,42 @@ -error[E0277]: `Cell` cannot be shared between threads safely - --> $DIR/generator-print-verbose-2.rs:19:17 - | -LL | assert_send(|| { - | _____-----------_^ - | | | - | | required by a bound introduced by this call -LL | | -LL | | drop(&a); -LL | | yield; -LL | | }); - | |_____^ `Cell` cannot be shared between threads safely - | - = help: the trait `Sync` is not implemented for `Cell` - = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead - = note: required for `&'?4 Cell` to implement `Send` -note: required because it's used within this generator - --> $DIR/generator-print-verbose-2.rs:19:17 +error: generator cannot be shared between threads safely + --> $DIR/generator-print-verbose-2.rs:17:5 | -LL | assert_send(|| { - | ^^ -note: required by a bound in `assert_send` - --> $DIR/generator-print-verbose-2.rs:10:23 +LL | assert_sync(|| { + | ^^^^^^^^^^^ generator is not `Sync` | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: generator cannot be shared between threads safely - --> $DIR/generator-print-verbose-2.rs:12:17 - | -LL | assert_sync(|| { - | _________________^ -LL | | -LL | | let a = Cell::new(2); -LL | | yield; -LL | | }); - | |_____^ generator is not `Sync` - | - = help: within `{main::{closure#0} upvar_tys=() {Cell, ()}}`, the trait `Sync` is not implemented for `Cell` - = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead + = help: within `{main::{closure#0} upvar_tys=() {main::{closure#0}}}`, the trait `Sync` is not implemented for `NotSync` note: generator is not `Sync` as this value is used across a yield - --> $DIR/generator-print-verbose-2.rs:15:9 + --> $DIR/generator-print-verbose-2.rs:20:9 | -LL | let a = Cell::new(2); - | - has type `Cell` which is not `Sync` +LL | let a = NotSync; + | - has type `NotSync` which is not `Sync` LL | yield; | ^^^^^ yield occurs here, with `a` maybe used later -LL | }); - | - `a` is later dropped here note: required by a bound in `assert_sync` - --> $DIR/generator-print-verbose-2.rs:9:23 + --> $DIR/generator-print-verbose-2.rs:14:23 | LL | fn assert_sync(_: T) {} | ^^^^ required by this bound in `assert_sync` +error: generator cannot be sent between threads safely + --> $DIR/generator-print-verbose-2.rs:24:5 + | +LL | assert_send(|| { + | ^^^^^^^^^^^ generator is not `Send` + | + = help: within `{main::{closure#1} upvar_tys=() {main::{closure#1}}}`, the trait `Send` is not implemented for `NotSend` +note: generator is not `Send` as this value is used across a yield + --> $DIR/generator-print-verbose-2.rs:27:9 + | +LL | let a = NotSend; + | - has type `NotSend` which is not `Send` +LL | yield; + | ^^^^^ yield occurs here, with `a` maybe used later +note: required by a bound in `assert_send` + --> $DIR/generator-print-verbose-2.rs:15:23 + | +LL | fn assert_send(_: T) {} + | ^^^^ required by this bound in `assert_send` + error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/retain-resume-ref.stderr b/tests/ui/generator/retain-resume-ref.stderr index e33310d12d9ef..bc715c7030eb3 100644 --- a/tests/ui/generator/retain-resume-ref.stderr +++ b/tests/ui/generator/retain-resume-ref.stderr @@ -4,9 +4,10 @@ error[E0499]: cannot borrow `thing` as mutable more than once at a time LL | gen.as_mut().resume(&mut thing); | ---------- first mutable borrow occurs here LL | gen.as_mut().resume(&mut thing); - | ------ ^^^^^^^^^^ second mutable borrow occurs here - | | - | first borrow later used by call + | ^^^^^^^^^^ second mutable borrow occurs here +LL | +LL | } + | - first borrow might be used here, when `gen` is dropped and runs the destructor for generator error: aborting due to previous error diff --git a/tests/ui/generator/unresolved-ct-var.rs b/tests/ui/generator/unresolved-ct-var.rs index 0a1570fc2395e..0316385fba93a 100644 --- a/tests/ui/generator/unresolved-ct-var.rs +++ b/tests/ui/generator/unresolved-ct-var.rs @@ -5,10 +5,5 @@ fn main() { let _ = async { let s = std::array::from_fn(|_| ()).await; //~^ ERROR `[(); _]` is not a future - //~| ERROR type inside `async` block must be known in this context - //~| ERROR type inside `async` block must be known in this context - //~| ERROR type inside `async` block must be known in this context - //~| ERROR type inside `async` block must be known in this context - //~| ERROR type inside `async` block must be known in this context }; } diff --git a/tests/ui/generator/unresolved-ct-var.stderr b/tests/ui/generator/unresolved-ct-var.stderr index ace254178b7fa..9badc1dc291ee 100644 --- a/tests/ui/generator/unresolved-ct-var.stderr +++ b/tests/ui/generator/unresolved-ct-var.stderr @@ -12,67 +12,6 @@ LL | let s = std::array::from_fn(|_| ()).await; = note: [(); _] must be a future or must implement `IntoFuture` to be awaited = note: required for `[(); _]` to implement `IntoFuture` -error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:6:17 - | -LL | let s = std::array::from_fn(|_| ()).await; - | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` - | -note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:6:45 - | -LL | let s = std::array::from_fn(|_| ()).await; - | ^^^^^ - -error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:6:17 - | -LL | let s = std::array::from_fn(|_| ()).await; - | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` - | -note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:6:45 - | -LL | let s = std::array::from_fn(|_| ()).await; - | ^^^^^ - -error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:6:17 - | -LL | let s = std::array::from_fn(|_| ()).await; - | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` - | -note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:6:45 - | -LL | let s = std::array::from_fn(|_| ()).await; - | ^^^^^ - -error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:6:17 - | -LL | let s = std::array::from_fn(|_| ()).await; - | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` - | -note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:6:45 - | -LL | let s = std::array::from_fn(|_| ()).await; - | ^^^^^ - -error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:6:17 - | -LL | let s = std::array::from_fn(|_| ()).await; - | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` - | -note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:6:45 - | -LL | let s = std::array::from_fn(|_| ()).await; - | ^^^^^ - -error: aborting due to 6 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0277, E0698. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/unsized-across-yield.rs b/tests/ui/generator/unsized-capture-across-yield.rs similarity index 66% rename from tests/ui/generator/unsized-across-yield.rs rename to tests/ui/generator/unsized-capture-across-yield.rs index 876d08ac1f0ef..7bcb0800ccfb8 100644 --- a/tests/ui/generator/unsized-across-yield.rs +++ b/tests/ui/generator/unsized-capture-across-yield.rs @@ -5,17 +5,6 @@ use std::ops::Generator; -fn across() -> impl Generator { - move || { - let b: [u8] = *(Box::new([]) as Box<[u8]>); - //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time - - yield; - - for elem in b.iter() {} - } -} - fn capture() -> impl Generator { let b: [u8] = *(Box::new([]) as Box<[u8]>); move || { @@ -29,6 +18,5 @@ fn capture() -> impl Generator { } fn main() { - across(); capture(); } diff --git a/tests/ui/generator/unsized-across-yield.stderr b/tests/ui/generator/unsized-capture-across-yield.stderr similarity index 61% rename from tests/ui/generator/unsized-across-yield.stderr rename to tests/ui/generator/unsized-capture-across-yield.stderr index 82375a0ec2d9a..8a5b968a56171 100644 --- a/tests/ui/generator/unsized-across-yield.stderr +++ b/tests/ui/generator/unsized-capture-across-yield.stderr @@ -1,5 +1,5 @@ warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/unsized-across-yield.rs:3:12 + --> $DIR/unsized-capture-across-yield.rs:3:12 | LL | #![feature(unsized_locals)] | ^^^^^^^^^^^^^^ @@ -8,16 +8,7 @@ LL | #![feature(unsized_locals)] = note: `#[warn(incomplete_features)]` on by default error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized-across-yield.rs:10:13 - | -LL | let b: [u8] = *(Box::new([]) as Box<[u8]>); - | ^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[u8]` - = note: all values live across `yield` must have a statically known size - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized-across-yield.rs:22:27 + --> $DIR/unsized-capture-across-yield.rs:11:27 | LL | move || { | -- this closure captures all values by move @@ -27,6 +18,6 @@ LL | println!("{:?}", &b); = help: the trait `Sized` is not implemented for `[u8]` = note: all values captured by value by a closure must have a statically known size -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generator/unsized-local-across-yield.rs b/tests/ui/generator/unsized-local-across-yield.rs new file mode 100644 index 0000000000000..f761f45c2af3a --- /dev/null +++ b/tests/ui/generator/unsized-local-across-yield.rs @@ -0,0 +1,21 @@ +#![feature(generator_trait)] +#![feature(generators)] +#![feature(unsized_locals)] +//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes + +use std::ops::Generator; + +fn across() -> impl Generator { + move || { + let b: [u8] = *(Box::new([]) as Box<[u8]>); + //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time + + yield; + + for elem in b.iter() {} + } +} + +fn main() { + across(); +} diff --git a/tests/ui/generator/unsized-local-across-yield.stderr b/tests/ui/generator/unsized-local-across-yield.stderr new file mode 100644 index 0000000000000..1942f266e6cc4 --- /dev/null +++ b/tests/ui/generator/unsized-local-across-yield.stderr @@ -0,0 +1,21 @@ +warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/unsized-local-across-yield.rs:3:12 + | +LL | #![feature(unsized_locals)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #48055 for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/unsized-local-across-yield.rs:10:13 + | +LL | let b: [u8] = *(Box::new([]) as Box<[u8]>); + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u8]` + = note: all values live across `yield` must have a statically known size + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generic-associated-types/bugs/issue-100013.stderr b/tests/ui/generic-associated-types/bugs/issue-100013.stderr index 86dbad84d99d8..93c69422f00c7 100644 --- a/tests/ui/generic-associated-types/bugs/issue-100013.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-100013.stderr @@ -7,16 +7,6 @@ LL | | async {}.await; // a yield point LL | | } | |_____^ | -note: the lifetime defined here... - --> $DIR/issue-100013.rs:16:38 - | -LL | let x = None::>; // a type referencing GAT - | ^^ -note: ...must outlive the lifetime defined here - --> $DIR/issue-100013.rs:16:34 - | -LL | let x = None::>; // a type referencing GAT - | ^^ = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) error: lifetime bound not satisfied @@ -28,16 +18,6 @@ LL | | async {}.await; // a yield point LL | | } | |_____^ | -note: the lifetime `'b` defined here... - --> $DIR/issue-100013.rs:21:14 - | -LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send { - | ^^ -note: ...must outlive the lifetime `'a` defined here - --> $DIR/issue-100013.rs:21:10 - | -LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send { - | ^^ = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) error: lifetime may not live long enough @@ -62,16 +42,6 @@ LL | | async {}.await; // a yield point LL | | } | |_____^ | -note: the lifetime `'b` defined here... - --> $DIR/issue-100013.rs:28:18 - | -LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send { - | ^^ -note: ...must outlive the lifetime `'a` defined here - --> $DIR/issue-100013.rs:28:10 - | -LL | fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send { - | ^^ = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) error: aborting due to 4 previous errors diff --git a/tests/ui/impl-trait/issue-55872-2.rs b/tests/ui/impl-trait/issue-55872-2.rs index ec3d924cea775..8a96fdc5c63d1 100644 --- a/tests/ui/impl-trait/issue-55872-2.rs +++ b/tests/ui/impl-trait/issue-55872-2.rs @@ -13,6 +13,7 @@ impl Bar for S { fn foo() -> Self::E { async {} //~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias + //~| ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias } } diff --git a/tests/ui/impl-trait/issue-55872-2.stderr b/tests/ui/impl-trait/issue-55872-2.stderr index 11b8485c8bbfe..3e70f1cf80064 100644 --- a/tests/ui/impl-trait/issue-55872-2.stderr +++ b/tests/ui/impl-trait/issue-55872-2.stderr @@ -4,5 +4,11 @@ error: type parameter `T` is part of concrete type but not used in parameter lis LL | async {} | ^^^^^^^^ -error: aborting due to previous error +error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias + --> $DIR/issue-55872-2.rs:14:9 + | +LL | async {} + | ^^^^^^^^ + +error: aborting due to 2 previous errors diff --git a/tests/ui/impl-trait/recursive-generator.rs b/tests/ui/impl-trait/recursive-generator.rs index e876f0fb43f65..000af70c4540e 100644 --- a/tests/ui/impl-trait/recursive-generator.rs +++ b/tests/ui/impl-trait/recursive-generator.rs @@ -7,7 +7,6 @@ fn foo() -> impl Generator { //~| NOTE recursive opaque type //~| NOTE in this expansion of desugaring of || { - //~^ NOTE returning here let mut gen = Box::pin(foo()); //~^ NOTE generator captures itself here let mut r = gen.as_mut().resume(()); diff --git a/tests/ui/impl-trait/recursive-generator.stderr b/tests/ui/impl-trait/recursive-generator.stderr index 9d8139ef114ea..86e193d9599a1 100644 --- a/tests/ui/impl-trait/recursive-generator.stderr +++ b/tests/ui/impl-trait/recursive-generator.stderr @@ -1,18 +1,11 @@ error[E0720]: cannot resolve opaque type --> $DIR/recursive-generator.rs:5:13 | -LL | fn foo() -> impl Generator { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type +LL | fn foo() -> impl Generator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type ... -LL | / || { -LL | | -LL | | let mut gen = Box::pin(foo()); - | | ------- generator captures itself here -LL | | -... | -LL | | } -LL | | } - | |_____- returning here with type `{generator@$DIR/recursive-generator.rs:9:5: 9:7}` +LL | let mut gen = Box::pin(foo()); + | ------- generator captures itself here error: aborting due to previous error diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr index a792e37118560..1d919fb524049 100644 --- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr +++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr @@ -112,16 +112,11 @@ LL | (substs_change::<&T>(),) error[E0720]: cannot resolve opaque type --> $DIR/recursive-impl-trait-type-indirect.rs:72:24 | -LL | fn generator_hold() -> impl Sized { - | ^^^^^^^^^^ recursive opaque type -LL | -LL | / move || { -LL | | let x = generator_hold(); - | | - generator captures itself here -LL | | yield; -LL | | x; -LL | | } - | |_____- returning here with type `{generator@$DIR/recursive-impl-trait-type-indirect.rs:74:5: 74:12}` +LL | fn generator_hold() -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +... +LL | let x = generator_hold(); + | - generator captures itself here error[E0720]: cannot resolve opaque type --> $DIR/recursive-impl-trait-type-indirect.rs:86:26 diff --git a/tests/ui/lint/must_not_suspend/dedup.rs b/tests/ui/lint/must_not_suspend/dedup.rs index 81a08579bb7bc..867bdf2ec12bf 100644 --- a/tests/ui/lint/must_not_suspend/dedup.rs +++ b/tests/ui/lint/must_not_suspend/dedup.rs @@ -13,7 +13,10 @@ async fn wheeee(t: T) { } async fn yes() { - wheeee(&No {}).await; //~ ERROR `No` held across + let no = No {}; + //~^ ERROR `No` held across + wheeee(&no).await; + drop(no); } fn main() { diff --git a/tests/ui/lint/must_not_suspend/dedup.stderr b/tests/ui/lint/must_not_suspend/dedup.stderr index 6925b1640b296..5d5b04a5d9593 100644 --- a/tests/ui/lint/must_not_suspend/dedup.stderr +++ b/tests/ui/lint/must_not_suspend/dedup.stderr @@ -1,14 +1,17 @@ error: `No` held across a suspend point, but should not be - --> $DIR/dedup.rs:16:13 + --> $DIR/dedup.rs:16:9 | -LL | wheeee(&No {}).await; - | ^^^^^ ----- the value is held across this suspend point +LL | let no = No {}; + | ^^ +LL | +LL | wheeee(&no).await; + | ----- the value is held across this suspend point | help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point - --> $DIR/dedup.rs:16:13 + --> $DIR/dedup.rs:16:9 | -LL | wheeee(&No {}).await; - | ^^^^^ +LL | let no = No {}; + | ^^ note: the lint level is defined here --> $DIR/dedup.rs:3:9 | diff --git a/tests/ui/lint/must_not_suspend/ref.stderr b/tests/ui/lint/must_not_suspend/ref.stderr index 148af00a3d22a..ed91a4a0bc624 100644 --- a/tests/ui/lint/must_not_suspend/ref.stderr +++ b/tests/ui/lint/must_not_suspend/ref.stderr @@ -1,22 +1,22 @@ -error: `Umm` held across a suspend point, but should not be - --> $DIR/ref.rs:18:26 +error: reference to `Umm` held across a suspend point, but should not be + --> $DIR/ref.rs:18:13 | LL | let guard = &mut self.u; - | ^^^^^^ + | ^^^^^ LL | LL | other().await; | ----- the value is held across this suspend point | note: You gotta use Umm's, ya know? - --> $DIR/ref.rs:18:26 + --> $DIR/ref.rs:18:13 | LL | let guard = &mut self.u; - | ^^^^^^ + | ^^^^^ help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point - --> $DIR/ref.rs:18:26 + --> $DIR/ref.rs:18:13 | LL | let guard = &mut self.u; - | ^^^^^^ + | ^^^^^ note: the lint level is defined here --> $DIR/ref.rs:3:9 | diff --git a/tests/ui/lint/must_not_suspend/unit.rs b/tests/ui/lint/must_not_suspend/unit.rs index d3a19f704324d..af4a76caa4e11 100644 --- a/tests/ui/lint/must_not_suspend/unit.rs +++ b/tests/ui/lint/must_not_suspend/unit.rs @@ -19,6 +19,7 @@ async fn other() {} pub async fn uhoh() { let _guard = bar(); //~ ERROR `Umm` held across other().await; + drop(_guard); } fn main() { diff --git a/tests/ui/lint/must_not_suspend/warn.rs b/tests/ui/lint/must_not_suspend/warn.rs index 7fdea66a23517..2d5dd01e5bffb 100644 --- a/tests/ui/lint/must_not_suspend/warn.rs +++ b/tests/ui/lint/must_not_suspend/warn.rs @@ -18,8 +18,9 @@ fn bar() -> Umm { async fn other() {} pub async fn uhoh() { - let _guard = bar(); //~ WARNING `Umm` held across + let guard = bar(); //~ WARNING `Umm` held across other().await; + drop(guard); } fn main() { diff --git a/tests/ui/lint/must_not_suspend/warn.stderr b/tests/ui/lint/must_not_suspend/warn.stderr index 194433552cf1a..e59656e508c01 100644 --- a/tests/ui/lint/must_not_suspend/warn.stderr +++ b/tests/ui/lint/must_not_suspend/warn.stderr @@ -1,21 +1,21 @@ warning: `Umm` held across a suspend point, but should not be --> $DIR/warn.rs:21:9 | -LL | let _guard = bar(); - | ^^^^^^ +LL | let guard = bar(); + | ^^^^^ LL | other().await; | ----- the value is held across this suspend point | note: You gotta use Umm's, ya know? --> $DIR/warn.rs:21:9 | -LL | let _guard = bar(); - | ^^^^^^ +LL | let guard = bar(); + | ^^^^^ help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point --> $DIR/warn.rs:21:9 | -LL | let _guard = bar(); - | ^^^^^^ +LL | let guard = bar(); + | ^^^^^ note: the lint level is defined here --> $DIR/warn.rs:4:9 | diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs index e311a4af2f4ea..6b54718e35c92 100644 --- a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs +++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next -Zdrop-tracking-mir +// compile-flags: -Ztrait-solver=next // edition: 2021 // revisions: pass fail //[pass] check-pass diff --git a/tests/ui/traits/unsend-future.rs b/tests/ui/traits/unsend-future.rs index fbbc07b11e743..a8367573fbdfa 100644 --- a/tests/ui/traits/unsend-future.rs +++ b/tests/ui/traits/unsend-future.rs @@ -13,6 +13,7 @@ fn require_handler(h: H) {} async fn handler() { let a = &1 as *const i32; async {}.await; + let b = a; } fn main() { diff --git a/tests/ui/traits/unsend-future.stderr b/tests/ui/traits/unsend-future.stderr index 6ce1cf452f459..01829021b4a79 100644 --- a/tests/ui/traits/unsend-future.stderr +++ b/tests/ui/traits/unsend-future.stderr @@ -1,5 +1,5 @@ error: future cannot be sent between threads safely - --> $DIR/unsend-future.rs:19:21 + --> $DIR/unsend-future.rs:20:21 | LL | require_handler(handler) | ^^^^^^^ future returned by `handler` is not `Send` @@ -12,8 +12,6 @@ LL | let a = &1 as *const i32; | - has type `*const i32` which is not `Send` LL | async {}.await; | ^^^^^ await occurs here, with `a` maybe used later -LL | } - | - `a` is later dropped here note: required by a bound in `require_handler` --> $DIR/unsend-future.rs:11:23 | diff --git a/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs index baa22e1ce1806..f6cbbf04d8264 100644 --- a/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs +++ b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs @@ -1,6 +1,6 @@ // edition: 2021 // build-fail -//~^^ ERROR overflow evaluating the requirement `<() as Recur>::Recur == _` +//~^^ ERROR cycle detected when computing layout of #![feature(impl_trait_in_assoc_type)] diff --git a/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr index 0238694c24d3c..3312230bc81df 100644 --- a/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr +++ b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr @@ -1,5 +1,16 @@ -error[E0275]: overflow evaluating the requirement `<() as Recur>::Recur == _` +error[E0391]: cycle detected when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}` + | + = note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit`... + = note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<{async fn body@$DIR/indirect-recursion-issue-112047.rs:15:31: 17:2}>`... + = note: ...which requires computing layout of `core::mem::manually_drop::ManuallyDrop<{async fn body@$DIR/indirect-recursion-issue-112047.rs:15:31: 17:2}>`... + = note: ...which requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:15:31: 17:2}`... + = note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<<() as Recur>::Recur>`... + = note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}>`... + = note: ...which requires computing layout of `core::mem::manually_drop::ManuallyDrop<{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}>`... + = note: ...which again requires computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}`, completing the cycle + = note: cycle used when computing layout of `::Recur` + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to previous error -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0391`.