about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-08 10:24:46 +0000
committerbors <bors@rust-lang.org>2022-03-08 10:24:46 +0000
commitb97dc20784698730bd7bc1a20eabdcd32066d174 (patch)
tree411126fa7c5a4a0cd31761dcfadbfefa6fc6174a /compiler/rustc_parse/src/parser
parentd2710dbb305a4447b889f11918bc5df96084357c (diff)
parentb879216f079eb5a9f47fab8d59b567859b51fd2c (diff)
downloadrust-b97dc20784698730bd7bc1a20eabdcd32066d174.tar.gz
rust-b97dc20784698730bd7bc1a20eabdcd32066d174.zip
Auto merge of #94734 - matthiaskrgr:rollup-28shqhy, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #91993 (Tweak output for non-exhaustive `match` expression)
 - #92385 (Add Result::{ok, err, and, or, unwrap_or} as const)
 - #94559 (Remove argument from closure in thread::Scope::spawn.)
 - #94580 (Emit `unused_attributes` if a level attr only has a reason)
 - #94586 (Generalize `get_nullable_type` to allow types where null is all-ones.)
 - #94708 (diagnostics: only talk about `Cargo.toml` if running under Cargo)
 - #94712 (promot debug_assert to assert)
 - #94726 (:arrow_up: rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs4
-rw-r--r--compiler/rustc_parse/src/parser/item.rs5
2 files changed, 3 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index df865d77b9b..b993d48c995 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -20,7 +20,6 @@ use rustc_ast_pretty::pprust;
 use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, PResult};
 use rustc_session::lint::builtin::BREAK_WITH_LABEL_AND_LOOP;
 use rustc_session::lint::BuiltinLintDiagnostics;
-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};
@@ -2712,8 +2711,7 @@ impl<'a> Parser<'a> {
         let mut async_block_err = |e: &mut Diagnostic, span: Span| {
             recover_async = true;
             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");
+            e.help_use_latest_edition();
         };
 
         while self.token != token::CloseDelim(close_delim) {
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index 5db1e4e0523..06460c7b1b3 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -14,7 +14,7 @@ use rustc_ast::{FnHeader, ForeignItem, Path, PathSegment, Visibility, Visibility
 use rustc_ast::{MacArgs, MacCall, MacDelimiter};
 use rustc_ast_pretty::pprust;
 use rustc_errors::{struct_span_err, Applicability, PResult, StashKey};
-use rustc_span::edition::{Edition, LATEST_STABLE_EDITION};
+use rustc_span::edition::Edition;
 use rustc_span::lev_distance::lev_distance;
 use rustc_span::source_map::{self, Span};
 use rustc_span::symbol::{kw, sym, Ident, Symbol};
@@ -2102,8 +2102,7 @@ impl<'a> Parser<'a> {
             let diag = self.diagnostic();
             struct_span_err!(diag, span, E0670, "`async fn` is not permitted in Rust 2015")
                 .span_label(span, "to use `async fn`, switch to Rust 2018 or later")
-                .help(&format!("set `edition = \"{}\"` in `Cargo.toml`", LATEST_STABLE_EDITION))
-                .note("for more on editions, read https://doc.rust-lang.org/edition-guide")
+                .help_use_latest_edition()
                 .emit();
         }
     }