Skip to content

Commit 0e52a67

Browse files
committed
Bless tests.
1 parent 60e04d1 commit 0e52a67

File tree

86 files changed

+643
-1693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+643
-1693
lines changed

tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,43 @@ LL | let r = Rc::new(());
1212
| - has type `Rc<()>` which is not `Send`
1313
LL | bar().await
1414
| ^^^^^^ await occurs here, with `r` maybe used later
15-
LL | };
16-
| - `r` is later dropped here
1715
note: required by a bound in `is_send`
1816
--> $DIR/async-await-let-else.rs:19:15
1917
|
2018
LL | fn is_send<T: Send>(_: T) {}
2119
| ^^^^ required by this bound in `is_send`
2220

23-
error: future cannot be sent between threads safely
21+
error[E0277]: `Rc<()>` cannot be sent between threads safely
2422
--> $DIR/async-await-let-else.rs:50:13
2523
|
24+
LL | async fn foo2(x: Option<bool>) {
25+
| - within this `impl Future<Output = ()>`
26+
...
2627
LL | is_send(foo2(Some(true)));
27-
| ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send`
28+
| ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
29+
| |
30+
| required by a bound introduced by this call
2831
|
2932
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
30-
note: future is not `Send` as this value is used across an await
31-
--> $DIR/async-await-let-else.rs:23:26
32-
|
33-
LL | bar2(Rc::new(())).await
34-
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
35-
| |
36-
| has type `Rc<()>` which is not `Send`
37-
LL | };
38-
| - `Rc::new(())` is later dropped here
33+
note: required because it's used within this `async fn` body
34+
--> $DIR/async-await-let-else.rs:27:29
35+
|
36+
LL | async fn bar2<T>(_: T) -> ! {
37+
| _____________________________^
38+
LL | | panic!()
39+
LL | | }
40+
| |_^
41+
= note: required because it captures the following types: `impl Future<Output = !>`
42+
note: required because it's used within this `async fn` body
43+
--> $DIR/async-await-let-else.rs:21:32
44+
|
45+
LL | async fn foo2(x: Option<bool>) {
46+
| ________________________________^
47+
LL | | let Some(_) = x else {
48+
LL | | bar2(Rc::new(())).await
49+
LL | | };
50+
LL | | }
51+
| |_^
3952
note: required by a bound in `is_send`
4053
--> $DIR/async-await-let-else.rs:19:15
4154
|
@@ -53,9 +66,8 @@ note: future is not `Send` as this value is used across an await
5366
--> $DIR/async-await-let-else.rs:33:28
5467
|
5568
LL | (Rc::new(()), bar().await);
56-
| ----------- ^^^^^^ - `Rc::new(())` is later dropped here
57-
| | |
58-
| | await occurs here, with `Rc::new(())` maybe used later
69+
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
70+
| |
5971
| has type `Rc<()>` which is not `Send`
6072
note: required by a bound in `is_send`
6173
--> $DIR/async-await-let-else.rs:19:15
@@ -77,9 +89,6 @@ LL | let r = Rc::new(());
7789
| - has type `Rc<()>` which is not `Send`
7890
LL | bar().await;
7991
| ^^^^^^ await occurs here, with `r` maybe used later
80-
...
81-
LL | };
82-
| - `r` is later dropped here
8392
note: required by a bound in `is_send`
8493
--> $DIR/async-await-let-else.rs:19:15
8594
|
@@ -88,3 +97,4 @@ LL | fn is_send<T: Send>(_: T) {}
8897

8998
error: aborting due to 4 previous errors
9099

100+
For more information about this error, try `rustc --explain E0277`.

tests/ui/async-await/async-error-span.drop_tracking.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | let a;
1414
| ^ cannot infer type
1515
|
1616
note: the type is part of the `async fn` body because of this `await`
17-
--> $DIR/async-error-span.rs:17:17
17+
--> $DIR/async-error-span.rs:19:17
1818
|
1919
LL | get_future().await;
2020
| ^^^^^^

tests/ui/async-await/async-error-span.drop_tracking_mir.stderr

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@ LL | fn get_future() -> impl Future<Output = ()> {
77
= help: the trait `Future` is not implemented for `()`
88
= note: () must be a future or must implement `IntoFuture` to be awaited
99

10-
error[E0698]: type inside `async fn` body must be known in this context
10+
error[E0282]: type annotations needed
1111
--> $DIR/async-error-span.rs:16:9
1212
|
1313
LL | let a;
14-
| ^ cannot infer type
14+
| ^
1515
|
16-
note: the type is part of the `async fn` body because of this `await`
17-
--> $DIR/async-error-span.rs:17:17
16+
help: consider giving `a` an explicit type
1817
|
19-
LL | get_future().await;
20-
| ^^^^^^
18+
LL | let a: /* Type */;
19+
| ++++++++++++
2120

2221
error: aborting due to 2 previous errors
2322

24-
Some errors have detailed explanations: E0277, E0698.
23+
Some errors have detailed explanations: E0277, E0282.
2524
For more information about an error, try `rustc --explain E0277`.

tests/ui/async-await/async-error-span.no_drop_tracking.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | let a;
1414
| ^ cannot infer type
1515
|
1616
note: the type is part of the `async fn` body because of this `await`
17-
--> $DIR/async-error-span.rs:17:17
17+
--> $DIR/async-error-span.rs:19:17
1818
|
1919
LL | get_future().await;
2020
| ^^^^^^

tests/ui/async-await/async-error-span.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ fn get_future() -> impl Future<Output = ()> {
1313
}
1414

1515
async fn foo() {
16-
let a; //~ ERROR type inside `async fn` body must be known in this context
16+
let a;
17+
//[no_drop_tracking,drop_tracking]~^ ERROR type inside `async fn` body must be known in this context
18+
//[drop_tracking_mir]~^^ ERROR type annotations needed
1719
get_future().await;
1820
}
1921

tests/ui/async-await/async-error-span.stderr

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 3 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,3 @@
1-
error: future cannot be sent between threads safely
2-
--> $DIR/async-fn-nonsend.rs:70:17
3-
|
4-
LL | assert_send(local_dropped_before_await());
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send`
6-
|
7-
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
8-
note: future is not `Send` as this value is used across an await
9-
--> $DIR/async-fn-nonsend.rs:27:10
10-
|
11-
LL | let x = non_send();
12-
| - has type `impl Debug` which is not `Send`
13-
LL | drop(x);
14-
LL | fut().await;
15-
| ^^^^^^ await occurs here, with `x` maybe used later
16-
LL | }
17-
| - `x` is later dropped here
18-
note: required by a bound in `assert_send`
19-
--> $DIR/async-fn-nonsend.rs:67:24
20-
|
21-
LL | fn assert_send(_: impl Send) {}
22-
| ^^^^ required by this bound in `assert_send`
23-
241
error: future cannot be sent between threads safely
252
--> $DIR/async-fn-nonsend.rs:72:17
263
|
@@ -32,12 +9,9 @@ note: future is not `Send` as this value is used across an await
329
--> $DIR/async-fn-nonsend.rs:36:25
3310
|
3411
LL | match Some(non_send()) {
35-
| ---------- has type `impl Debug` which is not `Send`
12+
| ---------------- has type `Option<impl Debug>` which is not `Send`
3613
LL | Some(_) => fut().await,
37-
| ^^^^^^ await occurs here, with `non_send()` maybe used later
38-
...
39-
LL | }
40-
| - `non_send()` is later dropped here
14+
| ^^^^^^ await occurs here, with `Some(non_send())` maybe used later
4115
note: required by a bound in `assert_send`
4216
--> $DIR/async-fn-nonsend.rs:67:24
4317
|
@@ -59,62 +33,11 @@ LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
5933
...
6034
LL | fut().await;
6135
| ^^^^^^ await occurs here, with `get_formatter()` maybe used later
62-
LL | }
63-
LL | }
64-
| - `get_formatter()` is later dropped here
65-
note: required by a bound in `assert_send`
66-
--> $DIR/async-fn-nonsend.rs:67:24
67-
|
68-
LL | fn assert_send(_: impl Send) {}
69-
| ^^^^ required by this bound in `assert_send`
70-
71-
error: future cannot be sent between threads safely
72-
--> $DIR/async-fn-nonsend.rs:76:17
73-
|
74-
LL | assert_send(non_sync_with_method_call_panic());
75-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_panic` is not `Send`
76-
|
77-
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
78-
note: future is not `Send` as this value is used across an await
79-
--> $DIR/async-fn-nonsend.rs:56:14
80-
|
81-
LL | let f: &mut std::fmt::Formatter = panic!();
82-
| - has type `&mut Formatter<'_>` which is not `Send`
83-
LL | if non_sync().fmt(f).unwrap() == () {
84-
LL | fut().await;
85-
| ^^^^^^ await occurs here, with `f` maybe used later
86-
LL | }
87-
LL | }
88-
| - `f` is later dropped here
89-
note: required by a bound in `assert_send`
90-
--> $DIR/async-fn-nonsend.rs:67:24
91-
|
92-
LL | fn assert_send(_: impl Send) {}
93-
| ^^^^ required by this bound in `assert_send`
94-
95-
error: future cannot be sent between threads safely
96-
--> $DIR/async-fn-nonsend.rs:78:17
97-
|
98-
LL | assert_send(non_sync_with_method_call_infinite_loop());
99-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_infinite_loop` is not `Send`
100-
|
101-
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
102-
note: future is not `Send` as this value is used across an await
103-
--> $DIR/async-fn-nonsend.rs:63:14
104-
|
105-
LL | let f: &mut std::fmt::Formatter = loop {};
106-
| - has type `&mut Formatter<'_>` which is not `Send`
107-
LL | if non_sync().fmt(f).unwrap() == () {
108-
LL | fut().await;
109-
| ^^^^^^ await occurs here, with `f` maybe used later
110-
LL | }
111-
LL | }
112-
| - `f` is later dropped here
11336
note: required by a bound in `assert_send`
11437
--> $DIR/async-fn-nonsend.rs:67:24
11538
|
11639
LL | fn assert_send(_: impl Send) {}
11740
| ^^^^ required by this bound in `assert_send`
11841

119-
error: aborting due to 5 previous errors
42+
error: aborting due to 2 previous errors
12043

tests/ui/async-await/async-fn-nonsend.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ fn assert_send(_: impl Send) {}
6868

6969
pub fn pass_assert() {
7070
assert_send(local_dropped_before_await());
71-
//[no_drop_tracking,drop_tracking_mir]~^ ERROR future cannot be sent between threads safely
71+
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
7272
assert_send(non_send_temporary_in_match());
7373
//~^ ERROR future cannot be sent between threads safely
7474
assert_send(non_sync_with_method_call());
7575
//~^ ERROR future cannot be sent between threads safely
7676
assert_send(non_sync_with_method_call_panic());
77-
//[no_drop_tracking,drop_tracking_mir]~^ ERROR future cannot be sent between threads safely
77+
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
7878
assert_send(non_sync_with_method_call_infinite_loop());
79-
//[no_drop_tracking,drop_tracking_mir]~^ ERROR future cannot be sent between threads safely
79+
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
8080
}

tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ LL | let mut info = self.info_result.clone();
1313
...
1414
LL | let _ = send_element(element).await;
1515
| ^^^^^^ await occurs here, with `mut info` maybe used later
16-
LL | }
17-
| - `mut info` is later dropped here
1816
note: required by a bound in `assert_send`
1917
--> $DIR/drop-track-field-assign-nonsend.rs:40:19
2018
|

tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ LL | let mut info = self.info_result.clone();
1313
...
1414
LL | let _ = send_element(element).await;
1515
| ^^^^^^ await occurs here, with `mut info` maybe used later
16-
LL | }
17-
| - `mut info` is later dropped here
1816
note: required by a bound in `assert_send`
1917
--> $DIR/field-assign-nonsend.rs:40:19
2018
|

tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: future cannot be shared between threads safely
2-
--> $DIR/issue-64130-1-sync.rs:24:13
2+
--> $DIR/issue-64130-1-sync.rs:25:13
33
|
44
LL | is_sync(bar());
55
| ^^^^^ future returned by `bar` is not `Sync`
@@ -12,6 +12,7 @@ LL | let x = Foo;
1212
| - has type `Foo` which is not `Sync`
1313
LL | baz().await;
1414
| ^^^^^^ await occurs here, with `x` maybe used later
15+
LL | drop(x);
1516
LL | }
1617
| - `x` is later dropped here
1718
note: required by a bound in `is_sync`

tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: future cannot be shared between threads safely
2-
--> $DIR/issue-64130-1-sync.rs:24:13
2+
--> $DIR/issue-64130-1-sync.rs:25:13
33
|
44
LL | is_sync(bar());
55
| ^^^^^ future returned by `bar` is not `Sync`
@@ -12,8 +12,6 @@ LL | let x = Foo;
1212
| - has type `Foo` which is not `Sync`
1313
LL | baz().await;
1414
| ^^^^^^ await occurs here, with `x` maybe used later
15-
LL | }
16-
| - `x` is later dropped here
1715
note: required by a bound in `is_sync`
1816
--> $DIR/issue-64130-1-sync.rs:14:15
1917
|

tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: future cannot be shared between threads safely
2-
--> $DIR/issue-64130-1-sync.rs:24:13
2+
--> $DIR/issue-64130-1-sync.rs:25:13
33
|
44
LL | is_sync(bar());
55
| ^^^^^ future returned by `bar` is not `Sync`
@@ -12,6 +12,7 @@ LL | let x = Foo;
1212
| - has type `Foo` which is not `Sync`
1313
LL | baz().await;
1414
| ^^^^^^ await occurs here, with `x` maybe used later
15+
LL | drop(x);
1516
LL | }
1617
| - `x` is later dropped here
1718
note: required by a bound in `is_sync`

tests/ui/async-await/issue-64130-1-sync.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ fn is_sync<T: Sync>(t: T) { }
1616
async fn bar() {
1717
let x = Foo;
1818
baz().await;
19+
drop(x);
1920
}
2021

2122
async fn baz() { }

tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ error: future cannot be sent between threads safely
44
LL | is_send(bar());
55
| ^^^^^ future returned by `bar` is not `Send`
66
|
7-
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
7+
= note: the trait bound `Unique<Foo>: Send` is not satisfied
88
note: future is not `Send` as this value is used across an await
99
--> $DIR/issue-64130-2-send.rs:18:10
1010
|
11-
LL | let x = Foo;
12-
| - has type `Foo` which is not `Send`
11+
LL | let x = Box::new(Foo);
12+
| - has type `Box<Foo>` which is not `Send`
1313
LL | baz().await;
1414
| ^^^^^^ await occurs here, with `x` maybe used later
1515
LL | }
@@ -19,6 +19,10 @@ note: required by a bound in `is_send`
1919
|
2020
LL | fn is_send<T: Send>(t: T) { }
2121
| ^^^^ required by this bound in `is_send`
22+
help: consider borrowing here
23+
|
24+
LL | is_send(&bar());
25+
| +
2226

2327
error: aborting due to previous error
2428

0 commit comments

Comments
 (0)