diff options
| author | bors <bors@rust-lang.org> | 2021-01-01 03:41:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-01 03:41:31 +0000 |
| commit | f8ab56bf3201b0638e44caf5a484041f22e32d65 (patch) | |
| tree | 2db271db195f182297ed2c2858426c43ec578f86 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 99ad5a1a2824fea1ecf60068fd3636beae7ea2da (diff) | |
| parent | 3cbdbe8dcd6a61154b7b5a74707e9e4274df5ed8 (diff) | |
| download | rust-f8ab56bf3201b0638e44caf5a484041f22e32d65.tar.gz rust-f8ab56bf3201b0638e44caf5a484041f22e32d65.zip | |
Auto merge of #79576 - m-ou-se:2021, r=Mark-Simulacrum
Add edition 2021. :fireworks: Happy new ~~year~~ Rust. :champagne: This adds --edition=2021, and updates suggestions about 2018 to say "2018 *or later*". Related Cargo PR: https://github.com/rust-lang/cargo/pull/8922 --- Edit: This adds the new edition as *unstable*. Without `-Z unstable-options`, `--edition=2021` results in: ``` $ rustc --edition=2021 error: edition 2021 is unstable and only available with -Z unstable-options. ```
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index b147f42fada..d11db74a3bd 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -15,6 +15,7 @@ use rustc_ast::{AnonConst, BinOp, BinOpKind, FnDecl, FnRetTy, MacCall, Param, Ty use rustc_ast::{Arm, Async, BlockCheckMode, Expr, ExprKind, Label, Movability, RangeLimits}; use rustc_ast_pretty::pprust; use rustc_errors::{Applicability, DiagnosticBuilder, PResult}; +use rustc_span::edition::LATEST_STABLE_EDITION; use rustc_span::source_map::{self, Span, Spanned}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{BytePos, Pos}; @@ -2108,8 +2109,8 @@ impl<'a> Parser<'a> { let mut async_block_err = |e: &mut DiagnosticBuilder<'_>, span: Span| { recover_async = true; - e.span_label(span, "`async` blocks are only allowed in the 2018 edition"); - e.help("set `edition = \"2018\"` in `Cargo.toml`"); + e.span_label(span, "`async` blocks are only allowed in Rust 2018 or later"); + e.help(&format!("set `edition = \"{}\"` in `Cargo.toml`", LATEST_STABLE_EDITION)); e.note("for more on editions, read https://doc.rust-lang.org/edition-guide"); }; |
