Skip to content

Commit

Permalink
Auto merge of #88100 - HTG-YT:edition2021-compopt-stabilization, r=m-…
Browse files Browse the repository at this point in the history
…ou-se

Make Edition 2021 Stable

An item of #87959.

This is an "on-demand" pull request, which means it will be merged when it is the right time to.
  • Loading branch information
bors committed Aug 31, 2021
2 parents 6f388bb + 10eed8f commit 56ea5e0
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_span/src/edition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub const EDITION_NAME_LIST: &str = "2015|2018|2021";

pub const DEFAULT_EDITION: Edition = Edition::Edition2015;

pub const LATEST_STABLE_EDITION: Edition = Edition::Edition2018;
pub const LATEST_STABLE_EDITION: Edition = Edition::Edition2021;

impl fmt::Display for Edition {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down Expand Up @@ -66,7 +66,7 @@ impl Edition {
match *self {
Edition::Edition2015 => true,
Edition::Edition2018 => true,
Edition::Edition2021 => false,
Edition::Edition2021 => true,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc/src/command-line-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ This informs `rustc` of the name of your crate.
<a id="option-edition"></a>
## `--edition`: specify the edition to use

This flag takes a value of `2015` or `2018`. The default is `2015`. More
This flag takes a value of `2015`, `2018` or `2021`. The default is `2015`. More
information about editions may be found in the [edition guide].

[edition guide]: ../edition-guide/introduction.html
Expand Down
18 changes: 9 additions & 9 deletions src/test/ui/async-await/edition-deny-async-fns-2015.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
LL | async fn foo() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
Expand All @@ -13,7 +13,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
LL | fn baz() { async fn foo() {} }
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
Expand All @@ -22,7 +22,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
LL | async fn async_baz() {
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
Expand All @@ -31,7 +31,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
Expand All @@ -40,7 +40,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
LL | async fn foo() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
Expand All @@ -49,7 +49,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
LL | async fn foo() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
Expand All @@ -58,7 +58,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
Expand All @@ -67,7 +67,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
LL | async fn foo() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in Rust 2015
Expand All @@ -76,7 +76,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0706]: functions in traits cannot be declared `async`
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/async-await/suggest-switching-edition-on-await.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn await_on_struct_missing() {
//~^ ERROR no field `await` on type
//~| NOTE unknown field
//~| NOTE to `.await` a `Future`, switch to Rust 2018
//~| HELP set `edition = "2018"` in `Cargo.toml`
//~| HELP set `edition = "2021"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
}

Expand All @@ -23,7 +23,7 @@ fn await_on_struct_similar() {
//~^ ERROR no field `await` on type
//~| HELP a field with a similar name exists
//~| NOTE to `.await` a `Future`, switch to Rust 2018
//~| HELP set `edition = "2018"` in `Cargo.toml`
//~| HELP set `edition = "2021"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
}

Expand All @@ -32,14 +32,14 @@ fn await_on_63533(x: Pin<&mut dyn Future<Output = ()>>) {
//~^ ERROR no field `await` on type
//~| NOTE unknown field
//~| NOTE to `.await` a `Future`, switch to Rust 2018
//~| HELP set `edition = "2018"` in `Cargo.toml`
//~| HELP set `edition = "2021"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
}

fn await_on_apit(x: impl Future<Output = ()>) {
x.await;
//~^ ERROR no field `await` on type
//~| NOTE to `.await` a `Future`, switch to Rust 2018
//~| HELP set `edition = "2018"` in `Cargo.toml`
//~| HELP set `edition = "2021"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | x.await;
| ^^^^^ unknown field
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= 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`
Expand All @@ -15,7 +15,7 @@ LL | x.await;
| ^^^^^ help: a field with a similar name exists: `awai`
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0609]: no field `await` on type `Pin<&mut dyn Future<Output = ()>>`
Expand All @@ -25,7 +25,7 @@ LL | x.await;
| ^^^^^ unknown field
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0609]: no field `await` on type `impl Future<Output = ()>`
Expand All @@ -35,7 +35,7 @@ LL | x.await;
| ^^^^^
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error: aborting due to 4 previous errors
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/editions/async-block-2015.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
async fn foo() {
//~^ ERROR `async fn` is not permitted in Rust 2015
//~| NOTE to use `async fn`, switch to Rust 2018 or later
//~| HELP set `edition = "2018"` in `Cargo.toml`
//~| HELP set `edition = "2021"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide

let x = async {};
Expand All @@ -11,15 +11,15 @@ async fn foo() {
let x = 42;
//~^ ERROR expected identifier, found keyword `let`
//~| NOTE expected identifier, found keyword
//~| HELP set `edition = "2018"` in `Cargo.toml`
//~| HELP set `edition = "2021"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
42
};
let z = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
42
//~^ ERROR expected identifier, found `42`
//~| NOTE expected identifier
//~| HELP set `edition = "2018"` in `Cargo.toml`
//~| HELP set `edition = "2021"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
};
y.await;
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/editions/async-block-2015.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
LL | async fn foo() {
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error: expected identifier, found keyword `let`
Expand All @@ -15,7 +15,7 @@ LL | let y = async {
LL | let x = 42;
| ^^^ expected identifier, found keyword
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error: expected identifier, found `42`
Expand All @@ -26,7 +26,7 @@ LL | let z = async {
LL | 42
| ^^ expected identifier
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0422]: cannot find struct, variant or union type `async` in this scope
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/impl-trait/issues/issue-79099.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | let f: impl core::future::Future<Output = u8> = async { 1 };
| |
| `async` blocks are only allowed in Rust 2018 or later
|
= help: set `edition = "2018"` in `Cargo.toml`
= help: set `edition = "2021"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0562]: `impl Trait` not allowed outside of function and method return types
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/rust-2021/reserved-prefixes.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: -Z unstable-options --edition 2021
// edition:2021

macro_rules! demo2 {
( $a:tt $b:tt ) => { println!("two tokens") };
Expand Down

0 comments on commit 56ea5e0

Please sign in to comment.