Skip to content

Commit 98c51fd

Browse files
committed
Update tests
1 parent 376aced commit 98c51fd

15 files changed

+116
-92
lines changed

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

+16-16
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,6 @@ LL | | break 0u8;
1818
LL | | };
1919
| |_________- enclosing `async` block
2020

21-
error[E0308]: mismatched types
22-
--> $DIR/async-block-control-flow-static-semantics.rs:13:43
23-
|
24-
LL | fn return_targets_async_block_not_fn() -> u8 {
25-
| --------------------------------- ^^ expected `u8`, found `()`
26-
| |
27-
| implicitly returns `()` as its body has no tail or `return` expression
28-
29-
error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
30-
--> $DIR/async-block-control-flow-static-semantics.rs:18:39
31-
|
32-
LL | let _: &dyn Future<Output = ()> = &block;
33-
| ^^^^^^ expected `()`, found `u8`
34-
|
35-
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
36-
3721
error[E0308]: mismatched types
3822
--> $DIR/async-block-control-flow-static-semantics.rs:22:58
3923
|
@@ -55,6 +39,22 @@ LL | let _: &dyn Future<Output = ()> = &block;
5539
|
5640
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
5741

42+
error[E0308]: mismatched types
43+
--> $DIR/async-block-control-flow-static-semantics.rs:13:43
44+
|
45+
LL | fn return_targets_async_block_not_fn() -> u8 {
46+
| --------------------------------- ^^ expected `u8`, found `()`
47+
| |
48+
| implicitly returns `()` as its body has no tail or `return` expression
49+
50+
error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
51+
--> $DIR/async-block-control-flow-static-semantics.rs:18:39
52+
|
53+
LL | let _: &dyn Future<Output = ()> = &block;
54+
| ^^^^^^ expected `()`, found `u8`
55+
|
56+
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
57+
5858
error[E0308]: mismatched types
5959
--> $DIR/async-block-control-flow-static-semantics.rs:48:44
6060
|

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

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use std::future::Future;
66

77
fn get_future() -> impl Future<Output = ()> {
8+
//~^ ERROR the trait bound `(): std::future::Future` is not satisfied
89
panic!()
910
}
1011

Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
1+
error[E0277]: the trait bound `(): std::future::Future` is not satisfied
2+
--> $DIR/async-error-span.rs:7:20
3+
|
4+
LL | fn get_future() -> impl Future<Output = ()> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `()`
6+
LL |
7+
LL | panic!()
8+
| -------- this returned value is of type `!`
9+
|
10+
= note: the return type of a function must have a statically known size
11+
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
12+
113
error[E0698]: type inside `async fn` body must be known in this context
2-
--> $DIR/async-error-span.rs:12:9
14+
--> $DIR/async-error-span.rs:13:9
315
|
416
LL | let a;
517
| ^ cannot infer type
618
|
719
note: the type is part of the `async fn` body because of this `await`
8-
--> $DIR/async-error-span.rs:13:5
20+
--> $DIR/async-error-span.rs:14:5
921
|
1022
LL | get_future().await;
1123
| ^^^^^^^^^^^^^^^^^^
1224

13-
error: aborting due to previous error
25+
error: aborting due to 2 previous errors
1426

15-
For more information about this error, try `rustc --explain E0698`.
27+
Some errors have detailed explanations: E0277, E0698.
28+
For more information about an error, try `rustc --explain E0277`.

src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ fn foo10() -> Result<(), ()> {
6262
fn foo11() -> Result<(), ()> {
6363
let _ = await bar()?; //~ ERROR `await` is only allowed inside `async` functions and blocks
6464
//~^ ERROR incorrect use of `await`
65+
//~| ERROR the `?` operator can only be applied to values that implement `std::ops::Try`
6566
Ok(())
6667
}
6768
fn foo12() -> Result<(), ()> {

src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr

+29-20
Original file line numberDiff line numberDiff line change
@@ -71,63 +71,63 @@ LL | let _ = await bar()?;
7171
| ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar()?.await`
7272

7373
error: incorrect use of `await`
74-
--> $DIR/incorrect-syntax-suggestions.rs:68:14
74+
--> $DIR/incorrect-syntax-suggestions.rs:69:14
7575
|
7676
LL | let _ = (await bar())?;
7777
| ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
7878

7979
error: incorrect use of `await`
80-
--> $DIR/incorrect-syntax-suggestions.rs:73:24
80+
--> $DIR/incorrect-syntax-suggestions.rs:74:24
8181
|
8282
LL | let _ = bar().await();
8383
| ^^ help: `await` is not a method call, remove the parentheses
8484

8585
error: incorrect use of `await`
86-
--> $DIR/incorrect-syntax-suggestions.rs:78:24
86+
--> $DIR/incorrect-syntax-suggestions.rs:79:24
8787
|
8888
LL | let _ = bar().await()?;
8989
| ^^ help: `await` is not a method call, remove the parentheses
9090

9191
error: incorrect use of `await`
92-
--> $DIR/incorrect-syntax-suggestions.rs:106:13
92+
--> $DIR/incorrect-syntax-suggestions.rs:107:13
9393
|
9494
LL | let _ = await!(bar());
9595
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
9696

9797
error: incorrect use of `await`
98-
--> $DIR/incorrect-syntax-suggestions.rs:110:13
98+
--> $DIR/incorrect-syntax-suggestions.rs:111:13
9999
|
100100
LL | let _ = await!(bar())?;
101101
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
102102

103103
error: incorrect use of `await`
104-
--> $DIR/incorrect-syntax-suggestions.rs:115:17
104+
--> $DIR/incorrect-syntax-suggestions.rs:116:17
105105
|
106106
LL | let _ = await!(bar())?;
107107
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
108108

109109
error: incorrect use of `await`
110-
--> $DIR/incorrect-syntax-suggestions.rs:123:17
110+
--> $DIR/incorrect-syntax-suggestions.rs:124:17
111111
|
112112
LL | let _ = await!(bar())?;
113113
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
114114

115115
error: expected expression, found `=>`
116-
--> $DIR/incorrect-syntax-suggestions.rs:131:25
116+
--> $DIR/incorrect-syntax-suggestions.rs:132:25
117117
|
118118
LL | match await { await => () }
119119
| ----- ^^ expected expression
120120
| |
121121
| while parsing this incorrect await expression
122122

123123
error: incorrect use of `await`
124-
--> $DIR/incorrect-syntax-suggestions.rs:131:11
124+
--> $DIR/incorrect-syntax-suggestions.rs:132:11
125125
|
126126
LL | match await { await => () }
127127
| ^^^^^^^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ await => () }.await`
128128

129129
error: expected one of `.`, `?`, `{`, or an operator, found `}`
130-
--> $DIR/incorrect-syntax-suggestions.rs:134:1
130+
--> $DIR/incorrect-syntax-suggestions.rs:135:1
131131
|
132132
LL | match await { await => () }
133133
| ----- - expected one of `.`, `?`, `{`, or an operator
@@ -162,71 +162,71 @@ LL | let _ = await bar()?;
162162
| ^^^^^^^^^^^^ only allowed inside `async` functions and blocks
163163

164164
error[E0728]: `await` is only allowed inside `async` functions and blocks
165-
--> $DIR/incorrect-syntax-suggestions.rs:68:14
165+
--> $DIR/incorrect-syntax-suggestions.rs:69:14
166166
|
167167
LL | fn foo12() -> Result<(), ()> {
168168
| ----- this is not `async`
169169
LL | let _ = (await bar())?;
170170
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
171171

172172
error[E0728]: `await` is only allowed inside `async` functions and blocks
173-
--> $DIR/incorrect-syntax-suggestions.rs:73:13
173+
--> $DIR/incorrect-syntax-suggestions.rs:74:13
174174
|
175175
LL | fn foo13() -> Result<(), ()> {
176176
| ----- this is not `async`
177177
LL | let _ = bar().await();
178178
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
179179

180180
error[E0728]: `await` is only allowed inside `async` functions and blocks
181-
--> $DIR/incorrect-syntax-suggestions.rs:78:13
181+
--> $DIR/incorrect-syntax-suggestions.rs:79:13
182182
|
183183
LL | fn foo14() -> Result<(), ()> {
184184
| ----- this is not `async`
185185
LL | let _ = bar().await()?;
186186
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
187187

188188
error[E0728]: `await` is only allowed inside `async` functions and blocks
189-
--> $DIR/incorrect-syntax-suggestions.rs:83:13
189+
--> $DIR/incorrect-syntax-suggestions.rs:84:13
190190
|
191191
LL | fn foo15() -> Result<(), ()> {
192192
| ----- this is not `async`
193193
LL | let _ = bar().await;
194194
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
195195

196196
error[E0728]: `await` is only allowed inside `async` functions and blocks
197-
--> $DIR/incorrect-syntax-suggestions.rs:87:13
197+
--> $DIR/incorrect-syntax-suggestions.rs:88:13
198198
|
199199
LL | fn foo16() -> Result<(), ()> {
200200
| ----- this is not `async`
201201
LL | let _ = bar().await?;
202202
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
203203

204204
error[E0728]: `await` is only allowed inside `async` functions and blocks
205-
--> $DIR/incorrect-syntax-suggestions.rs:92:17
205+
--> $DIR/incorrect-syntax-suggestions.rs:93:17
206206
|
207207
LL | fn foo() -> Result<(), ()> {
208208
| --- this is not `async`
209209
LL | let _ = bar().await?;
210210
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
211211

212212
error[E0728]: `await` is only allowed inside `async` functions and blocks
213-
--> $DIR/incorrect-syntax-suggestions.rs:99:17
213+
--> $DIR/incorrect-syntax-suggestions.rs:100:17
214214
|
215215
LL | let foo = || {
216216
| -- this is not `async`
217217
LL | let _ = bar().await?;
218218
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
219219

220220
error[E0728]: `await` is only allowed inside `async` functions and blocks
221-
--> $DIR/incorrect-syntax-suggestions.rs:115:17
221+
--> $DIR/incorrect-syntax-suggestions.rs:116:17
222222
|
223223
LL | fn foo() -> Result<(), ()> {
224224
| --- this is not `async`
225225
LL | let _ = await!(bar())?;
226226
| ^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
227227

228228
error[E0728]: `await` is only allowed inside `async` functions and blocks
229-
--> $DIR/incorrect-syntax-suggestions.rs:123:17
229+
--> $DIR/incorrect-syntax-suggestions.rs:124:17
230230
|
231231
LL | let foo = || {
232232
| -- this is not `async`
@@ -242,7 +242,16 @@ LL | let _ = await bar()?;
242242
= help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
243243
= note: required by `std::ops::Try::into_result`
244244

245-
error: aborting due to 35 previous errors
245+
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
246+
--> $DIR/incorrect-syntax-suggestions.rs:63:19
247+
|
248+
LL | let _ = await bar()?;
249+
| ^^^^^^ the `?` operator cannot be applied to type `impl std::future::Future`
250+
|
251+
= help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
252+
= note: required by `std::ops::Try::into_result`
253+
254+
error: aborting due to 36 previous errors
246255

247256
Some errors have detailed explanations: E0277, E0728.
248257
For more information about an error, try `rustc --explain E0277`.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// edition:2018
2+
3+
trait From {
4+
fn from();
5+
}
6+
7+
impl From for () {
8+
fn from() {}
9+
}
10+
11+
impl From for () {
12+
//~^ ERROR conflicting implementations of trait
13+
fn from() {}
14+
}
15+
16+
fn bar() -> impl core::future::Future<Output = ()> {
17+
async move { From::from() }
18+
}
19+
20+
fn main() {}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0119]: conflicting implementations of trait `From` for type `()`:
2+
--> $DIR/issue-67651.rs:11:1
3+
|
4+
LL | impl From for () {
5+
| ---------------- first implementation here
6+
...
7+
LL | impl From for () {
8+
| ^^^^^^^^^^^^^^^^ conflicting implementation for `()`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0119`.

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

-13
This file was deleted.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ trait Foo {}
88

99
impl Xyz {
1010
async fn do_sth<'a>(
11-
foo: &dyn Foo, bar: &'a dyn Foo //~ ERROR cannot infer
11+
foo: &dyn Foo, bar: &'a dyn Foo
1212
) -> &dyn Foo //~ ERROR missing lifetime specifier
1313
{
1414
foo

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

+1-16
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,6 @@ LL | ) -> &dyn Foo
88
|
99
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `foo` or `bar`
1010

11-
error: cannot infer an appropriate lifetime
12-
--> $DIR/issue-63388-2.rs:11:9
13-
|
14-
LL | foo: &dyn Foo, bar: &'a dyn Foo
15-
| ^^^ ...but this borrow...
16-
...
17-
LL | foo
18-
| --- this return type evaluates to the `'static` lifetime...
19-
|
20-
note: ...can't outlive the lifetime `'_` as defined on the method body at 11:14
21-
--> $DIR/issue-63388-2.rs:11:14
22-
|
23-
LL | foo: &dyn Foo, bar: &'a dyn Foo
24-
| ^
25-
26-
error: aborting due to 2 previous errors
11+
error: aborting due to previous error
2712

2813
For more information about this error, try `rustc --explain E0106`.

src/test/ui/async-await/issues/issue-65159.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
async fn copy() -> Result<()> //~ ERROR wrong number of type arguments
66
{
77
Ok(())
8+
//~^ type annotations needed
89
}
910

1011
fn main() { }

src/test/ui/async-await/issues/issue-65159.stderr

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ error[E0107]: wrong number of type arguments: expected 2, found 1
44
LL | async fn copy() -> Result<()>
55
| ^^^^^^^^^^ expected 2 type arguments
66

7-
error: aborting due to previous error
7+
error[E0282]: type annotations needed
8+
--> $DIR/issue-65159.rs:7:5
9+
|
10+
LL | Ok(())
11+
| ^^ cannot infer type for type parameter `E` declared on the enum `Result`
12+
13+
error: aborting due to 2 previous errors
814

9-
For more information about this error, try `rustc --explain E0107`.
15+
Some errors have detailed explanations: E0107, E0282.
16+
For more information about an error, try `rustc --explain E0107`.

src/test/ui/self/elision/ref-self-async.nll.stderr

-13
This file was deleted.

src/test/ui/self/elision/ref-self-async.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// edition:2018
22

33
#![allow(non_snake_case)]
4+
#![feature(arbitrary_self_types)]
45

56
use std::marker::PhantomData;
67
use std::ops::Deref;

0 commit comments

Comments
 (0)