Skip to content

Commit dce20bf

Browse files
committed
WIP fix tests
1 parent 81cd596 commit dce20bf

20 files changed

+221
-187
lines changed

src/test/ui/async-await/async-block-control-flow-static-semantics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn return_targets_async_block_not_fn() -> u8 {
2020
}
2121

2222
async fn return_targets_async_block_not_async_fn() -> u8 {
23-
//~^ ERROR type mismatch resolving
23+
//~^ ERROR mismatched types
2424
let block = async {
2525
return 0u8;
2626
};

src/test/ui/async-await/async-block-control-flow-static-semantics.stderr

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ LL | let _: &dyn Future<Output = ()> = &block;
3939
found type `()`
4040
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
4141

42+
error[E0308]: mismatched types
43+
--> $DIR/async-block-control-flow-static-semantics.rs:22:58
44+
|
45+
LL | async fn return_targets_async_block_not_async_fn() -> u8 {
46+
| __________________________________________________________^
47+
LL | |
48+
LL | | let block = async {
49+
LL | | return 0u8;
50+
... |
51+
LL | |
52+
LL | | }
53+
| |_^ expected u8, found ()
54+
|
55+
= note: expected type `u8`
56+
found type `()`
57+
4258
error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
4359
--> $DIR/async-block-control-flow-static-semantics.rs:27:39
4460
|
@@ -49,16 +65,6 @@ LL | let _: &dyn Future<Output = ()> = &block;
4965
found type `()`
5066
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
5167

52-
error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == u8`
53-
--> $DIR/async-block-control-flow-static-semantics.rs:22:55
54-
|
55-
LL | async fn return_targets_async_block_not_async_fn() -> u8 {
56-
| ^^ expected (), found u8
57-
|
58-
= note: expected type `()`
59-
found type `u8`
60-
= note: the return type of a function must have a statically known size
61-
6268
error[E0308]: mismatched types
6369
--> $DIR/async-block-control-flow-static-semantics.rs:48:44
6470
|

src/test/ui/async-await/async-error-span.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn get_future() -> impl Future<Output = ()> {
99
}
1010

1111
async fn foo() {
12-
let a; //~ ERROR type inside `async` object must be known in this context
12+
let a; //~ ERROR type inside `async` fn body must be known in this context
1313
get_future().await;
1414
}
1515

src/test/ui/async-await/async-error-span.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0698]: type inside `async` object must be known in this context
1+
error[E0698]: type inside `async` fn body must be known in this context
22
--> $DIR/async-error-span.rs:12:9
33
|
44
LL | let a;
55
| ^ cannot infer type
66
|
7-
note: the type is part of the `async` object because of this `await`
7+
note: the type is part of the `async` fn body because of this `await`
88
--> $DIR/async-error-span.rs:13:5
99
|
1010
LL | get_future().await;

src/test/ui/async-await/issues/issue-63388-1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ trait Foo {}
99
impl Xyz {
1010
async fn do_sth<'a>(
1111
&'a self, foo: &dyn Foo
12-
) -> &dyn Foo //~ ERROR lifetime mismatch
12+
) -> &dyn Foo
1313
{
14-
foo
14+
foo //~ ERROR lifetime mismatch
1515
}
1616
}
1717

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
error[E0623]: lifetime mismatch
2-
--> $DIR/issue-63388-1.rs:12:10
2+
--> $DIR/issue-63388-1.rs:14:9
33
|
44
LL | &'a self, foo: &dyn Foo
55
| -------- this parameter and the return type are declared with different lifetimes...
66
LL | ) -> &dyn Foo
7-
| ^^^^^^^^
8-
| |
9-
| ...but data from `foo` is returned here
7+
| --------
8+
LL | {
9+
LL | foo
10+
| ^^^ ...but data from `foo` is returned here
1011

1112
error: aborting due to previous error
1213

src/test/ui/async-await/issues/issue-63388-2.stderr

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ error: cannot infer an appropriate lifetime
1111
|
1212
LL | foo: &dyn Foo, bar: &'a dyn Foo
1313
| ^^^ ...but this borrow...
14-
LL | ) -> &dyn Foo
15-
| -------- this return type evaluates to the `'static` lifetime...
14+
...
15+
LL | foo
16+
| --- this return type evaluates to the `'static` lifetime...
1617
|
1718
note: ...can't outlive the lifetime '_ as defined on the method body at 11:14
1819
--> $DIR/issue-63388-2.rs:11:14
@@ -21,8 +22,8 @@ LL | foo: &dyn Foo, bar: &'a dyn Foo
2122
| ^
2223
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 11:14
2324
|
24-
LL | ) -> &dyn Foo + '_
25-
| ^^^^^^^^^^^^^
25+
LL | foo + '_
26+
|
2627

2728
error: aborting due to 2 previous errors
2829

src/test/ui/async-await/unresolved_type_param.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ async fn bar<T>() -> () {}
77

88
async fn foo() {
99
bar().await;
10-
//~^ ERROR type inside `async` object must be known in this context
10+
//~^ ERROR type inside `async` fn body must be known in this context
1111
//~| NOTE cannot infer type for `T`
12-
//~| NOTE the type is part of the `async` object because of this `await`
12+
//~| NOTE the type is part of the `async` fn body because of this `await`
1313
//~| NOTE in this expansion of desugaring of `await`
1414
}
1515
fn main() {}

src/test/ui/async-await/unresolved_type_param.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0698]: type inside `async` object must be known in this context
1+
error[E0698]: type inside `async` fn body must be known in this context
22
--> $DIR/unresolved_type_param.rs:9:5
33
|
44
LL | bar().await;
55
| ^^^ cannot infer type for `T`
66
|
7-
note: the type is part of the `async` object because of this `await`
7+
note: the type is part of the `async` fn body because of this `await`
88
--> $DIR/unresolved_type_param.rs:9:5
99
|
1010
LL | bar().await;

src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
error[E0623]: lifetime mismatch
2-
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:45
2+
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52
33
|
44
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
5-
| ---- ^^^^
6-
| | |
7-
| | ...but data from `f` is returned here
5+
| ---- ---- ^ ...but data from `f` is returned here
6+
| |
87
| this parameter and the return type are declared with different lifetimes...
98

109
error[E0623]: lifetime mismatch
11-
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:55
10+
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:82
1211
|
1312
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
14-
| ----- ^^^^^^^^^^^^^^^^^
15-
| | |
16-
| | ...but data from `f` is returned here
13+
| ----- ----------------- ^ ...but data from `f` is returned here
14+
| |
1715
| this parameter and the return type are declared with different lifetimes...
1816

1917
error[E0623]: lifetime mismatch
20-
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:58
18+
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64
2119
|
2220
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
23-
| ----- ^^^
24-
| | |
25-
| | ...but data from `arg` is returned here
21+
| ----- --- ^^^ ...but data from `arg` is returned here
22+
| |
2623
| this parameter and the return type are declared with different lifetimes...
2724

2825
error: aborting due to 3 previous errors

0 commit comments

Comments
 (0)