Skip to content

Commit 56ea5e0

Browse files
committed
Auto merge of rust-lang#88100 - HTG-YT:edition2021-compopt-stabilization, r=m-ou-se
Make Edition 2021 Stable An item of rust-lang#87959. This is an "on-demand" pull request, which means it will be merged when it is the right time to.
2 parents 6f388bb + 10eed8f commit 56ea5e0

9 files changed

+28
-28
lines changed

compiler/rustc_span/src/edition.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub const EDITION_NAME_LIST: &str = "2015|2018|2021";
3232

3333
pub const DEFAULT_EDITION: Edition = Edition::Edition2015;
3434

35-
pub const LATEST_STABLE_EDITION: Edition = Edition::Edition2018;
35+
pub const LATEST_STABLE_EDITION: Edition = Edition::Edition2021;
3636

3737
impl fmt::Display for Edition {
3838
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -66,7 +66,7 @@ impl Edition {
6666
match *self {
6767
Edition::Edition2015 => true,
6868
Edition::Edition2018 => true,
69-
Edition::Edition2021 => false,
69+
Edition::Edition2021 => true,
7070
}
7171
}
7272
}

src/doc/rustc/src/command-line-arguments.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ This informs `rustc` of the name of your crate.
9393
<a id="option-edition"></a>
9494
## `--edition`: specify the edition to use
9595

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

9999
[edition guide]: ../edition-guide/introduction.html

src/test/ui/async-await/edition-deny-async-fns-2015.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
44
LL | async fn foo() {}
55
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
66
|
7-
= help: set `edition = "2018"` in `Cargo.toml`
7+
= help: set `edition = "2021"` in `Cargo.toml`
88
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
99

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

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

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

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

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

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

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

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

8282
error[E0706]: functions in traits cannot be declared `async`

src/test/ui/async-await/suggest-switching-edition-on-await.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn await_on_struct_missing() {
1010
//~^ ERROR no field `await` on type
1111
//~| NOTE unknown field
1212
//~| NOTE to `.await` a `Future`, switch to Rust 2018
13-
//~| HELP set `edition = "2018"` in `Cargo.toml`
13+
//~| HELP set `edition = "2021"` in `Cargo.toml`
1414
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
1515
}
1616

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

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

3939
fn await_on_apit(x: impl Future<Output = ()>) {
4040
x.await;
4141
//~^ ERROR no field `await` on type
4242
//~| NOTE to `.await` a `Future`, switch to Rust 2018
43-
//~| HELP set `edition = "2018"` in `Cargo.toml`
43+
//~| HELP set `edition = "2021"` in `Cargo.toml`
4444
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
4545
}

src/test/ui/async-await/suggest-switching-edition-on-await.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | x.await;
55
| ^^^^^ unknown field
66
|
77
= note: to `.await` a `Future`, switch to Rust 2018 or later
8-
= help: set `edition = "2018"` in `Cargo.toml`
8+
= help: set `edition = "2021"` in `Cargo.toml`
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`
@@ -15,7 +15,7 @@ LL | x.await;
1515
| ^^^^^ help: a field with a similar name exists: `awai`
1616
|
1717
= note: to `.await` a `Future`, switch to Rust 2018 or later
18-
= help: set `edition = "2018"` in `Cargo.toml`
18+
= help: set `edition = "2021"` in `Cargo.toml`
1919
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
2020

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

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

4141
error: aborting due to 4 previous errors

src/test/ui/editions/async-block-2015.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
async fn foo() {
22
//~^ ERROR `async fn` is not permitted in Rust 2015
33
//~| NOTE to use `async fn`, switch to Rust 2018 or later
4-
//~| HELP set `edition = "2018"` in `Cargo.toml`
4+
//~| HELP set `edition = "2021"` in `Cargo.toml`
55
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
66

77
let x = async {};
@@ -11,15 +11,15 @@ async fn foo() {
1111
let x = 42;
1212
//~^ ERROR expected identifier, found keyword `let`
1313
//~| NOTE expected identifier, found keyword
14-
//~| HELP set `edition = "2018"` in `Cargo.toml`
14+
//~| HELP set `edition = "2021"` in `Cargo.toml`
1515
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
1616
42
1717
};
1818
let z = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
1919
42
2020
//~^ ERROR expected identifier, found `42`
2121
//~| NOTE expected identifier
22-
//~| HELP set `edition = "2018"` in `Cargo.toml`
22+
//~| HELP set `edition = "2021"` in `Cargo.toml`
2323
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
2424
};
2525
y.await;

src/test/ui/editions/async-block-2015.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
44
LL | async fn foo() {
55
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
66
|
7-
= help: set `edition = "2018"` in `Cargo.toml`
7+
= help: set `edition = "2021"` in `Cargo.toml`
88
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
99

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

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

3232
error[E0422]: cannot find struct, variant or union type `async` in this scope

src/test/ui/impl-trait/issues/issue-79099.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | let f: impl core::future::Future<Output = u8> = async { 1 };
66
| |
77
| `async` blocks are only allowed in Rust 2018 or later
88
|
9-
= help: set `edition = "2018"` in `Cargo.toml`
9+
= help: set `edition = "2021"` in `Cargo.toml`
1010
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
1111

1212
error[E0562]: `impl Trait` not allowed outside of function and method return types

src/test/ui/rust-2021/reserved-prefixes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags: -Z unstable-options --edition 2021
1+
// edition:2021
22

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

0 commit comments

Comments
 (0)