Skip to content

Add missing edition directives for async-await tests #141587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition:2015
//@ check-pass
// Make sure that we don't eagerly recover `async ::Bound` in edition 2015.

Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/async-fn/edition-2015.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition:2015
fn foo(x: impl async Fn()) -> impl async Fn() { x }
//~^ ERROR `async` trait bounds are only allowed in Rust 2018 or later
//~| ERROR `async` trait bounds are only allowed in Rust 2018 or later
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/async-await/async-fn/edition-2015.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: `async` trait bounds are only allowed in Rust 2018 or later
--> $DIR/edition-2015.rs:1:16
--> $DIR/edition-2015.rs:2:16
|
LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
| ^^^^^
Expand All @@ -8,7 +8,7 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

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

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

error[E0658]: `async` trait bounds are unstable
--> $DIR/edition-2015.rs:1:36
--> $DIR/edition-2015.rs:2:36
|
LL | fn foo(x: impl async Fn()) -> impl async Fn() { x }
| ^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition:2015
#![allow(non_camel_case_types)]
#![deny(keyword_idents)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
error: `await` is a keyword in the 2018 edition
--> $DIR/2015-edition-error-various-positions.rs:5:13
--> $DIR/2015-edition-error-various-positions.rs:6:13
|
LL | pub mod await {
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
note: the lint level is defined here
--> $DIR/2015-edition-error-various-positions.rs:2:9
--> $DIR/2015-edition-error-various-positions.rs:3:9
|
LL | #![deny(keyword_idents)]
| ^^^^^^^^^^^^^^
= note: `#[deny(keyword_idents_2018)]` implied by `#[deny(keyword_idents)]`

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

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

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

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

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

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

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

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

error: `await` is a keyword in the 2018 edition
--> $DIR/2015-edition-error-various-positions.rs:34:19
--> $DIR/2015-edition-error-various-positions.rs:35:19
|
LL | match await { await => {} }
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition:2015
//@ run-rustfix

#![allow(non_camel_case_types)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/await-keyword/2015-edition-warning.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition:2015
//@ run-rustfix

#![allow(non_camel_case_types)]
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/async-await/await-keyword/2015-edition-warning.stderr
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
error: `await` is a keyword in the 2018 edition
--> $DIR/2015-edition-warning.rs:7:13
--> $DIR/2015-edition-warning.rs:8:13
|
LL | pub mod await {
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
note: the lint level is defined here
--> $DIR/2015-edition-warning.rs:4:9
--> $DIR/2015-edition-warning.rs:5:9
|
LL | #![deny(keyword_idents)]
| ^^^^^^^^^^^^^^
= note: `#[deny(keyword_idents_2018)]` implied by `#[deny(keyword_idents)]`

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

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

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

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

error: `await` is a keyword in the 2018 edition
--> $DIR/2015-edition-warning.rs:22:19
--> $DIR/2015-edition-warning.rs:23:19
|
LL | match await { await => {} }
| ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`
Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/for-await-2015.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition:2015
//@ check-pass

#![feature(async_for_loop)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
error[E0034]: multiple applicable items in scope
--> $DIR/issue-65634-raw-ident-suggestion.rs:24:13
--> $DIR/issue-65634-raw-ident-suggestion.rs:25:13
|
LL | r#fn {}.r#struct();
| ^^^^^^^^ multiple `r#struct` found
|
note: candidate #1 is defined in an impl of the trait `async` for the type `r#fn`
--> $DIR/issue-65634-raw-ident-suggestion.rs:7:5
--> $DIR/issue-65634-raw-ident-suggestion.rs:8:5
|
LL | fn r#struct(&self) {
| ^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `await` for the type `r#fn`
--> $DIR/issue-65634-raw-ident-suggestion.rs:13:5
--> $DIR/issue-65634-raw-ident-suggestion.rs:14:5
|
LL | fn r#struct(&self) {
| ^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
error[E0034]: multiple applicable items in scope
--> $DIR/issue-65634-raw-ident-suggestion.rs:24:13
--> $DIR/issue-65634-raw-ident-suggestion.rs:25:13
|
LL | r#fn {}.r#struct();
| ^^^^^^^^ multiple `r#struct` found
|
note: candidate #1 is defined in an impl of the trait `r#async` for the type `r#fn`
--> $DIR/issue-65634-raw-ident-suggestion.rs:7:5
--> $DIR/issue-65634-raw-ident-suggestion.rs:8:5
|
LL | fn r#struct(&self) {
| ^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `r#await` for the type `r#fn`
--> $DIR/issue-65634-raw-ident-suggestion.rs:13:5
--> $DIR/issue-65634-raw-ident-suggestion.rs:14:5
|
LL | fn r#struct(&self) {
| ^^^^^^^^^^^^^^^^^^
Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/issue-65634-raw-ident-suggestion.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ revisions: edition2015 edition2018
//@[edition2015]edition:2015
//@[edition2018]edition:2018

#![allow(non_camel_case_types)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition:2015
//@ rustc-env:CARGO_CRATE_NAME=foo

use std::pin::Pin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0609]: no field `await` on type `await_on_struct_missing::S`
--> $DIR/suggest-switching-edition-on-await-cargo.rs:11:7
--> $DIR/suggest-switching-edition-on-await-cargo.rs:12:7
|
LL | x.await;
| ^^^^^ unknown field
Expand All @@ -9,7 +9,7 @@ LL | x.await;
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

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

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

error[E0609]: no field `await` on type `impl Future<Output = ()>`
--> $DIR/suggest-switching-edition-on-await-cargo.rs:43:7
--> $DIR/suggest-switching-edition-on-await-cargo.rs:44:7
|
LL | x.await;
| ^^^^^ unknown field
Expand Down
1 change: 1 addition & 0 deletions tests/ui/async-await/suggest-switching-edition-on-await.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition:2015
use std::pin::Pin;
use std::future::Future;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0609]: no field `await` on type `await_on_struct_missing::S`
--> $DIR/suggest-switching-edition-on-await.rs:9:7
--> $DIR/suggest-switching-edition-on-await.rs:10:7
|
LL | x.await;
| ^^^^^ unknown field
Expand All @@ -9,7 +9,7 @@ LL | x.await;
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

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

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

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