Skip to content

Commit

Permalink
Bless tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Sep 23, 2023
1 parent 286502c commit 211d2ed
Show file tree
Hide file tree
Showing 110 changed files with 486 additions and 918 deletions.
48 changes: 29 additions & 19 deletions tests/ui/async-await/async-await-let-else.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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: 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<bool>) {
| - within this `impl Future<Output = ()>`
...
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<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
--> $DIR/async-await-let-else.rs: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>(_: T) -> ! {
| _____________________________^
LL | | panic!()
LL | | }
| |_^
= note: required because it captures the following types: `impl Future<Output = !>`
note: required because it's used within this `async fn` body
--> $DIR/async-await-let-else.rs:18:32
|
LL | async fn foo2(x: Option<bool>) {
| ________________________________^
LL | | let Some(_) = x else {
LL | | bar2(Rc::new(())).await
LL | | };
LL | | }
| |_^
note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:16:15
|
Expand All @@ -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
Expand All @@ -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
|
Expand All @@ -88,3 +97,4 @@ LL | fn is_send<T: Send>(_: T) {}

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0277`.
2 changes: 1 addition & 1 deletion tests/ui/async-await/async-error-span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn get_future() -> impl Future<Output = ()> {
}

async fn foo() {
let a; //~ ERROR type inside `async fn` body must be known in this context
let a; //~ ERROR type annotations needed
get_future().await;
}

Expand Down
13 changes: 6 additions & 7 deletions tests/ui/async-await/async-error-span.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ LL | fn get_future() -> impl Future<Output = ()> {
= 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`.
2 changes: 1 addition & 1 deletion tests/ui/async-await/async-fn-nonsend.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
6 changes: 0 additions & 6 deletions tests/ui/async-await/async-fn-nonsend.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ LL | match Some(non_send()) {
| ---------------- has type `Option<impl Debug>` which is not `Send`
LL | Some(_) => fut().await,
| ^^^^^ await occurs here, with `Some(non_send())` maybe used later
...
LL | }
| - `Some(non_send())` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:64:24
|
Expand All @@ -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
|
Expand Down
14 changes: 5 additions & 9 deletions tests/ui/async-await/async-is-unwindsafe.stderr
Original file line number Diff line number Diff line change
@@ -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<'_>`
Expand All @@ -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
|
Expand Down
1 change: 0 additions & 1 deletion tests/ui/async-await/await-sequence.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// edition:2021
// compile-flags: -Z drop-tracking
// build-pass

use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion tests/ui/async-await/default-struct-update.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// build-pass
// edition:2018
// compile-flags: -Zdrop-tracking=y

fn main() {
let _ = foo();
Expand Down
1 change: 0 additions & 1 deletion tests/ui/async-await/drop-and-assign.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// edition:2021
// compile-flags: -Zdrop-tracking
// build-pass

struct A;
Expand Down
1 change: 0 additions & 1 deletion tests/ui/async-await/drop-track-bad-field-in-fru.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// compile-flags: -Zdrop-tracking
// edition: 2021

fn main() {}
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/async-await/drop-track-bad-field-in-fru.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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
|
= 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;
| -^^^^^
Expand Down
1 change: 0 additions & 1 deletion tests/ui/async-await/drop-track-field-assign-nonsend.rs
Original file line number Diff line number Diff line change
@@ -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)]

Expand Down
8 changes: 3 additions & 5 deletions tests/ui/async-await/drop-track-field-assign-nonsend.stderr
Original file line number Diff line number Diff line change
@@ -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<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
note: future is not `Send` as this value is used across an await
--> $DIR/drop-track-field-assign-nonsend.rs:21: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: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
Expand Down
1 change: 0 additions & 1 deletion tests/ui/async-await/drop-track-field-assign.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// compile-flags: -Zdrop-tracking
// incremental
// edition: 2021

Expand Down Expand Up @@ -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
});
}
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -29,34 +12,17 @@ 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
|
= 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

2 changes: 0 additions & 2 deletions tests/ui/async-await/field-assign-nonsend.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// edition: 2021
// build-fail
//~^^ ERROR overflow evaluating the requirement `<A as Second>::{opaque#0} == _`
//~^^ ERROR cycle detected when computing layout of

#![feature(async_fn_in_trait)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error[E0275]: overflow evaluating the requirement `<A as Second>::{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 `<<A as First>::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 `<impl at $DIR/indirect-recursion-issue-112047.rs:31:1: 31:21>::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`.
1 change: 1 addition & 0 deletions tests/ui/async-await/issue-64130-1-sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fn is_sync<T: Sync>(t: T) { }
async fn bar() {
let x = Foo;
baz().await;
drop(x);
}

async fn baz() { }
Expand Down
4 changes: 1 addition & 3 deletions tests/ui/async-await/issue-64130-1-sync.stderr
Original file line number Diff line number Diff line change
@@ -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`
Expand All @@ -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
|
Expand Down
Loading

0 comments on commit 211d2ed

Please sign in to comment.