Skip to content

Commit 38d1862

Browse files
Rollup merge of rust-lang#141587 - ferrocene:lw-yurotqzwvwlw, r=jieyouxu
Add missing edition directives for async-await tests These tests specifically test 2015 edition behavior
2 parents 9d46af1 + 1d35ac9 commit 38d1862

16 files changed

+45
-36
lines changed

tests/ui/async-await/async-fn/edition-2015-not-async-bound.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition:2015
12
//@ check-pass
23
// Make sure that we don't eagerly recover `async ::Bound` in edition 2015.
34

tests/ui/async-await/async-fn/edition-2015.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition:2015
12
fn foo(x: impl async Fn()) -> impl async Fn() { x }
23
//~^ ERROR `async` trait bounds are only allowed in Rust 2018 or later
34
//~| ERROR `async` trait bounds are only allowed in Rust 2018 or later

tests/ui/async-await/async-fn/edition-2015.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: `async` trait bounds are only allowed in Rust 2018 or later
2-
--> $DIR/edition-2015.rs:1:16
2+
--> $DIR/edition-2015.rs:2:16
33
|
44
LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
55
| ^^^^^
@@ -8,7 +8,7 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
88
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
99

1010
error: `async` trait bounds are only allowed in Rust 2018 or later
11-
--> $DIR/edition-2015.rs:1:36
11+
--> $DIR/edition-2015.rs:2:36
1212
|
1313
LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
1414
| ^^^^^
@@ -17,7 +17,7 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
1717
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
1818

1919
error[E0658]: `async` trait bounds are unstable
20-
--> $DIR/edition-2015.rs:1:16
20+
--> $DIR/edition-2015.rs:2:16
2121
|
2222
LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
2323
| ^^^^^
@@ -28,7 +28,7 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
2828
= help: use the desugared name of the async trait, such as `AsyncFn`
2929

3030
error[E0658]: `async` trait bounds are unstable
31-
--> $DIR/edition-2015.rs:1:36
31+
--> $DIR/edition-2015.rs:2:36
3232
|
3333
LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
3434
| ^^^^^

tests/ui/async-await/await-keyword/2015-edition-error-various-positions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition:2015
12
#![allow(non_camel_case_types)]
23
#![deny(keyword_idents)]
34

tests/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
error: `await` is a keyword in the 2018 edition
2-
--> $DIR/2015-edition-error-various-positions.rs:5:13
2+
--> $DIR/2015-edition-error-various-positions.rs:6:13
33
|
44
LL | pub mod await {
55
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
66
|
77
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
88
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
99
note: the lint level is defined here
10-
--> $DIR/2015-edition-error-various-positions.rs:2:9
10+
--> $DIR/2015-edition-error-various-positions.rs:3:9
1111
|
1212
LL | #![deny(keyword_idents)]
1313
| ^^^^^^^^^^^^^^
1414
= note: `#[deny(keyword_idents_2018)]` implied by `#[deny(keyword_idents)]`
1515

1616
error: `await` is a keyword in the 2018 edition
17-
--> $DIR/2015-edition-error-various-positions.rs:7:20
17+
--> $DIR/2015-edition-error-various-positions.rs:8:20
1818
|
1919
LL | pub struct await;
2020
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -23,7 +23,7 @@ LL | pub struct await;
2323
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
2424

2525
error: `await` is a keyword in the 2018 edition
26-
--> $DIR/2015-edition-error-various-positions.rs:11:16
26+
--> $DIR/2015-edition-error-various-positions.rs:12:16
2727
|
2828
LL | use outer_mod::await::await;
2929
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -32,7 +32,7 @@ LL | use outer_mod::await::await;
3232
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
3333

3434
error: `await` is a keyword in the 2018 edition
35-
--> $DIR/2015-edition-error-various-positions.rs:11:23
35+
--> $DIR/2015-edition-error-various-positions.rs:12:23
3636
|
3737
LL | use outer_mod::await::await;
3838
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -41,7 +41,7 @@ LL | use outer_mod::await::await;
4141
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
4242

4343
error: `await` is a keyword in the 2018 edition
44-
--> $DIR/2015-edition-error-various-positions.rs:16:14
44+
--> $DIR/2015-edition-error-various-positions.rs:17:14
4545
|
4646
LL | struct Foo { await: () }
4747
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -50,7 +50,7 @@ LL | struct Foo { await: () }
5050
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
5151

5252
error: `await` is a keyword in the 2018 edition
53-
--> $DIR/2015-edition-error-various-positions.rs:20:15
53+
--> $DIR/2015-edition-error-various-positions.rs:21:15
5454
|
5555
LL | impl Foo { fn await() {} }
5656
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -59,7 +59,7 @@ LL | impl Foo { fn await() {} }
5959
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
6060

6161
error: `await` is a keyword in the 2018 edition
62-
--> $DIR/2015-edition-error-various-positions.rs:24:14
62+
--> $DIR/2015-edition-error-various-positions.rs:25:14
6363
|
6464
LL | macro_rules! await {
6565
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -68,7 +68,7 @@ LL | macro_rules! await {
6868
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
6969

7070
error: `await` is a keyword in the 2018 edition
71-
--> $DIR/2015-edition-error-various-positions.rs:31:5
71+
--> $DIR/2015-edition-error-various-positions.rs:32:5
7272
|
7373
LL | await!();
7474
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -77,7 +77,7 @@ LL | await!();
7777
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
7878

7979
error: `await` is a keyword in the 2018 edition
80-
--> $DIR/2015-edition-error-various-positions.rs:34:11
80+
--> $DIR/2015-edition-error-various-positions.rs:35:11
8181
|
8282
LL | match await { await => {} }
8383
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -86,7 +86,7 @@ LL | match await { await => {} }
8686
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
8787

8888
error: `await` is a keyword in the 2018 edition
89-
--> $DIR/2015-edition-error-various-positions.rs:34:19
89+
--> $DIR/2015-edition-error-various-positions.rs:35:19
9090
|
9191
LL | match await { await => {} }
9292
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`

tests/ui/async-await/await-keyword/2015-edition-warning.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition:2015
12
//@ run-rustfix
23

34
#![allow(non_camel_case_types)]

tests/ui/async-await/await-keyword/2015-edition-warning.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition:2015
12
//@ run-rustfix
23

34
#![allow(non_camel_case_types)]

tests/ui/async-await/await-keyword/2015-edition-warning.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
error: `await` is a keyword in the 2018 edition
2-
--> $DIR/2015-edition-warning.rs:7:13
2+
--> $DIR/2015-edition-warning.rs:8:13
33
|
44
LL | pub mod await {
55
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
66
|
77
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
88
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
99
note: the lint level is defined here
10-
--> $DIR/2015-edition-warning.rs:4:9
10+
--> $DIR/2015-edition-warning.rs:5:9
1111
|
1212
LL | #![deny(keyword_idents)]
1313
| ^^^^^^^^^^^^^^
1414
= note: `#[deny(keyword_idents_2018)]` implied by `#[deny(keyword_idents)]`
1515

1616
error: `await` is a keyword in the 2018 edition
17-
--> $DIR/2015-edition-warning.rs:10:20
17+
--> $DIR/2015-edition-warning.rs:11:20
1818
|
1919
LL | pub struct await;
2020
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -23,7 +23,7 @@ LL | pub struct await;
2323
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
2424

2525
error: `await` is a keyword in the 2018 edition
26-
--> $DIR/2015-edition-warning.rs:15:16
26+
--> $DIR/2015-edition-warning.rs:16:16
2727
|
2828
LL | use outer_mod::await::await;
2929
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -32,7 +32,7 @@ LL | use outer_mod::await::await;
3232
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
3333

3434
error: `await` is a keyword in the 2018 edition
35-
--> $DIR/2015-edition-warning.rs:15:23
35+
--> $DIR/2015-edition-warning.rs:16:23
3636
|
3737
LL | use outer_mod::await::await;
3838
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -41,7 +41,7 @@ LL | use outer_mod::await::await;
4141
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
4242

4343
error: `await` is a keyword in the 2018 edition
44-
--> $DIR/2015-edition-warning.rs:22:11
44+
--> $DIR/2015-edition-warning.rs:23:11
4545
|
4646
LL | match await { await => {} }
4747
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
@@ -50,7 +50,7 @@ LL | match await { await => {} }
5050
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
5151

5252
error: `await` is a keyword in the 2018 edition
53-
--> $DIR/2015-edition-warning.rs:22:19
53+
--> $DIR/2015-edition-warning.rs:23:19
5454
|
5555
LL | match await { await => {} }
5656
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`

tests/ui/async-await/for-await-2015.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition:2015
12
//@ check-pass
23

34
#![feature(async_for_loop)]

tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2015.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
error[E0034]: multiple applicable items in scope
2-
--> $DIR/issue-65634-raw-ident-suggestion.rs:24:13
2+
--> $DIR/issue-65634-raw-ident-suggestion.rs:25:13
33
|
44
LL | r#fn {}.r#struct();
55
| ^^^^^^^^ multiple `r#struct` found
66
|
77
note: candidate #1 is defined in an impl of the trait `async` for the type `r#fn`
8-
--> $DIR/issue-65634-raw-ident-suggestion.rs:7:5
8+
--> $DIR/issue-65634-raw-ident-suggestion.rs:8:5
99
|
1010
LL | fn r#struct(&self) {
1111
| ^^^^^^^^^^^^^^^^^^
1212
note: candidate #2 is defined in an impl of the trait `await` for the type `r#fn`
13-
--> $DIR/issue-65634-raw-ident-suggestion.rs:13:5
13+
--> $DIR/issue-65634-raw-ident-suggestion.rs:14:5
1414
|
1515
LL | fn r#struct(&self) {
1616
| ^^^^^^^^^^^^^^^^^^

tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2018.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
error[E0034]: multiple applicable items in scope
2-
--> $DIR/issue-65634-raw-ident-suggestion.rs:24:13
2+
--> $DIR/issue-65634-raw-ident-suggestion.rs:25:13
33
|
44
LL | r#fn {}.r#struct();
55
| ^^^^^^^^ multiple `r#struct` found
66
|
77
note: candidate #1 is defined in an impl of the trait `r#async` for the type `r#fn`
8-
--> $DIR/issue-65634-raw-ident-suggestion.rs:7:5
8+
--> $DIR/issue-65634-raw-ident-suggestion.rs:8:5
99
|
1010
LL | fn r#struct(&self) {
1111
| ^^^^^^^^^^^^^^^^^^
1212
note: candidate #2 is defined in an impl of the trait `r#await` for the type `r#fn`
13-
--> $DIR/issue-65634-raw-ident-suggestion.rs:13:5
13+
--> $DIR/issue-65634-raw-ident-suggestion.rs:14:5
1414
|
1515
LL | fn r#struct(&self) {
1616
| ^^^^^^^^^^^^^^^^^^

tests/ui/async-await/issue-65634-raw-ident-suggestion.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ revisions: edition2015 edition2018
2+
//@[edition2015]edition:2015
23
//@[edition2018]edition:2018
34

45
#![allow(non_camel_case_types)]

tests/ui/async-await/suggest-switching-edition-on-await-cargo.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition:2015
12
//@ rustc-env:CARGO_CRATE_NAME=foo
23

34
use std::pin::Pin;

tests/ui/async-await/suggest-switching-edition-on-await-cargo.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0609]: no field `await` on type `await_on_struct_missing::S`
2-
--> $DIR/suggest-switching-edition-on-await-cargo.rs:11:7
2+
--> $DIR/suggest-switching-edition-on-await-cargo.rs:12:7
33
|
44
LL | x.await;
55
| ^^^^^ unknown field
@@ -9,7 +9,7 @@ LL | x.await;
99
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
1010

1111
error[E0609]: no field `await` on type `await_on_struct_similar::S`
12-
--> $DIR/suggest-switching-edition-on-await-cargo.rs:24:7
12+
--> $DIR/suggest-switching-edition-on-await-cargo.rs:25:7
1313
|
1414
LL | x.await;
1515
| ^^^^^ unknown field
@@ -24,7 +24,7 @@ LL + x.awai;
2424
|
2525

2626
error[E0609]: no field `await` on type `Pin<&mut dyn Future<Output = ()>>`
27-
--> $DIR/suggest-switching-edition-on-await-cargo.rs:34:7
27+
--> $DIR/suggest-switching-edition-on-await-cargo.rs:35:7
2828
|
2929
LL | x.await;
3030
| ^^^^^ unknown field
@@ -34,7 +34,7 @@ LL | x.await;
3434
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
3535

3636
error[E0609]: no field `await` on type `impl Future<Output = ()>`
37-
--> $DIR/suggest-switching-edition-on-await-cargo.rs:43:7
37+
--> $DIR/suggest-switching-edition-on-await-cargo.rs:44:7
3838
|
3939
LL | x.await;
4040
| ^^^^^ unknown field

tests/ui/async-await/suggest-switching-edition-on-await.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition:2015
12
use std::pin::Pin;
23
use std::future::Future;
34

tests/ui/async-await/suggest-switching-edition-on-await.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0609]: no field `await` on type `await_on_struct_missing::S`
2-
--> $DIR/suggest-switching-edition-on-await.rs:9:7
2+
--> $DIR/suggest-switching-edition-on-await.rs:10:7
33
|
44
LL | x.await;
55
| ^^^^^ unknown field
@@ -9,7 +9,7 @@ LL | x.await;
99
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
1010

1111
error[E0609]: no field `await` on type `await_on_struct_similar::S`
12-
--> $DIR/suggest-switching-edition-on-await.rs:22:7
12+
--> $DIR/suggest-switching-edition-on-await.rs:23:7
1313
|
1414
LL | x.await;
1515
| ^^^^^ unknown field
@@ -24,7 +24,7 @@ LL + x.awai;
2424
|
2525

2626
error[E0609]: no field `await` on type `Pin<&mut dyn Future<Output = ()>>`
27-
--> $DIR/suggest-switching-edition-on-await.rs:32:7
27+
--> $DIR/suggest-switching-edition-on-await.rs:33:7
2828
|
2929
LL | x.await;
3030
| ^^^^^ unknown field
@@ -34,7 +34,7 @@ LL | x.await;
3434
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
3535

3636
error[E0609]: no field `await` on type `impl Future<Output = ()>`
37-
--> $DIR/suggest-switching-edition-on-await.rs:41:7
37+
--> $DIR/suggest-switching-edition-on-await.rs:42:7
3838
|
3939
LL | x.await;
4040
| ^^^^^ unknown field

0 commit comments

Comments
 (0)