Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 13344e5

Browse files
committedMar 19, 2020
Update tests
1 parent 58c2388 commit 13344e5

17 files changed

+156
-93
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,27 @@
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+
112
error[E0698]: type inside `async fn` body must be known in this context
2-
--> $DIR/async-error-span.rs:12:9
13+
--> $DIR/async-error-span.rs:13:9
314
|
415
LL | let a;
516
| ^ cannot infer type
617
|
718
note: the type is part of the `async fn` body because of this `await`
8-
--> $DIR/async-error-span.rs:13:5
19+
--> $DIR/async-error-span.rs:14:5
920
|
1021
LL | get_future().await;
1122
| ^^^^^^^^^^^^^^^^^^
1223

13-
error: aborting due to previous error
24+
error: aborting due to 2 previous errors
1425

15-
For more information about this error, try `rustc --explain E0698`.
26+
Some errors have detailed explanations: E0277, E0698.
27+
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/async-await/multiple-lifetimes/ret-impl-trait-no-fg.rs

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ impl<T> Trait<'_, '_> for T { }
99
async fn async_ret_impl_trait<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
1010
//~^ ERROR ambiguous lifetime bound
1111
//~| ERROR ambiguous lifetime bound
12+
//~| ERROR ambiguous lifetime bound
13+
//~| ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds
14+
//~| ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds
1215
(a, b)
1316
}
1417

‎src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-no-fg.stderr

+38-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,42 @@ LL | async fn async_ret_impl_trait<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'
1414
|
1515
= help: add #![feature(member_constraints)] to the crate attributes to enable
1616

17-
error: aborting due to 2 previous errors
17+
error: ambiguous lifetime bound in `impl Trait`
18+
--> $DIR/ret-impl-trait-no-fg.rs:9:64
19+
|
20+
LL | async fn async_ret_impl_trait<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
21+
| ^^^^^^^^^^^^^^^^^^ the elided lifetimes here do not outlive one another
22+
|
23+
= help: add #![feature(member_constraints)] to the crate attributes to enable
24+
25+
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
26+
--> $DIR/ret-impl-trait-no-fg.rs:9:1
27+
|
28+
LL | / async fn async_ret_impl_trait<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
29+
LL | |
30+
LL | |
31+
LL | |
32+
... |
33+
LL | | (a, b)
34+
LL | | }
35+
| |_^
36+
|
37+
= note: hidden type `(&u8, &u8)` captures lifetime '_#4r
38+
39+
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
40+
--> $DIR/ret-impl-trait-no-fg.rs:9:1
41+
|
42+
LL | / async fn async_ret_impl_trait<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
43+
LL | |
44+
LL | |
45+
LL | |
46+
... |
47+
LL | | (a, b)
48+
LL | | }
49+
| |_^
50+
|
51+
= note: hidden type `(&u8, &u8)` captures lifetime '_#5r
52+
53+
error: aborting due to 5 previous errors
1854

55+
For more information about this error, try `rustc --explain E0700`.

‎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;

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0623]: lifetime mismatch
2-
--> $DIR/ref-self-async.rs:22:9
2+
--> $DIR/ref-self-async.rs:23:9
33
|
44
LL | async fn ref_self(&self, f: &u32) -> &u32 {
55
| ----- ----
@@ -9,7 +9,7 @@ LL | f
99
| ^ ...but data from `f` is returned here
1010

1111
error[E0623]: lifetime mismatch
12-
--> $DIR/ref-self-async.rs:28:9
12+
--> $DIR/ref-self-async.rs:29:9
1313
|
1414
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
1515
| ----- ----
@@ -19,7 +19,7 @@ LL | f
1919
| ^ ...but data from `f` is returned here
2020

2121
error[E0623]: lifetime mismatch
22-
--> $DIR/ref-self-async.rs:32:9
22+
--> $DIR/ref-self-async.rs:33:9
2323
|
2424
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
2525
| ----- ----
@@ -29,7 +29,7 @@ LL | f
2929
| ^ ...but data from `f` is returned here
3030

3131
error[E0623]: lifetime mismatch
32-
--> $DIR/ref-self-async.rs:36:9
32+
--> $DIR/ref-self-async.rs:37:9
3333
|
3434
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
3535
| ----- ----
@@ -39,7 +39,7 @@ LL | f
3939
| ^ ...but data from `f` is returned here
4040

4141
error[E0623]: lifetime mismatch
42-
--> $DIR/ref-self-async.rs:40:9
42+
--> $DIR/ref-self-async.rs:41:9
4343
|
4444
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
4545
| ----- ----
@@ -49,7 +49,7 @@ LL | f
4949
| ^ ...but data from `f` is returned here
5050

5151
error[E0623]: lifetime mismatch
52-
--> $DIR/ref-self-async.rs:44:9
52+
--> $DIR/ref-self-async.rs:45:9
5353
|
5454
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
5555
| ----- ----
@@ -59,7 +59,7 @@ LL | f
5959
| ^ ...but data from `f` is returned here
6060

6161
error[E0623]: lifetime mismatch
62-
--> $DIR/ref-self-async.rs:48:9
62+
--> $DIR/ref-self-async.rs:49:9
6363
|
6464
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
6565
| ----- ---

0 commit comments

Comments
 (0)
Please sign in to comment.