1
Fork 0

Consistently call editions "Rust 20xx" in messages.

This commit is contained in:
Mara Bos 2020-11-30 22:11:29 +01:00
parent f16ef7d7ce
commit c574ded57d
8 changed files with 31 additions and 31 deletions

View file

@ -2109,7 +2109,7 @@ impl<'a> Parser<'a> {
let mut async_block_err = |e: &mut DiagnosticBuilder<'_>, span: Span| { let mut async_block_err = |e: &mut DiagnosticBuilder<'_>, span: Span| {
recover_async = true; recover_async = true;
e.span_label(span, "`async` blocks are only allowed in edition 2018 or later"); 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.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.note("for more on editions, read https://doc.rust-lang.org/edition-guide");
}; };

View file

@ -1667,7 +1667,7 @@ impl<'a> Parser<'a> {
fn ban_async_in_2015(&self, span: Span) { fn ban_async_in_2015(&self, span: Span) {
if span.rust_2015() { if span.rust_2015() {
let diag = self.diagnostic(); let diag = self.diagnostic();
struct_span_err!(diag, span, E0670, "`async fn` is not permitted in the 2015 edition") 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") .span_label(span, "to use `async fn`, switch to Rust 2018 or later")
.help(&format!("set `edition = \"{}\"` in `Cargo.toml`", LATEST_STABLE_EDITION)) .help(&format!("set `edition = \"{}\"` in `Cargo.toml`", LATEST_STABLE_EDITION))
.note("for more on editions, read https://doc.rust-lang.org/edition-guide") .note("for more on editions, read https://doc.rust-lang.org/edition-guide")

View file

@ -180,7 +180,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
( (
format!("cannot find {} `{}` in {}{}", expected, item_str, mod_prefix, mod_str), format!("cannot find {} `{}` in {}{}", expected, item_str, mod_prefix, mod_str),
if path_str == "async" && expected.starts_with("struct") { if path_str == "async" && expected.starts_with("struct") {
"`async` blocks are only allowed in the 2018 edition".to_string() "`async` blocks are only allowed in Rust 2018 or later".to_string()
} else { } else {
format!("not found in {}", mod_str) format!("not found in {}", mod_str)
}, },
@ -904,7 +904,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
if path_str == "try" && span.rust_2015() { if path_str == "try" && span.rust_2015() {
err.note("if you want the `try` keyword, you need to be in the 2018 edition"); err.note("if you want the `try` keyword, you need Rust 2018 or later");
} }
} }
(Res::Def(DefKind::TyAlias, def_id), PathSource::Trait(_)) => { (Res::Def(DefKind::TyAlias, def_id), PathSource::Trait(_)) => {

View file

@ -1,21 +1,21 @@
// edition:2015 // edition:2015
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in the 2015 edition fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in Rust 2015
async fn async_baz() { //~ ERROR `async fn` is not permitted in the 2015 edition async fn async_baz() { //~ ERROR `async fn` is not permitted in Rust 2015
async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
} }
struct Foo {} struct Foo {}
impl Foo { impl Foo {
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
} }
trait Bar { trait Bar {
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
//~^ ERROR functions in traits cannot be declared `async` //~^ ERROR functions in traits cannot be declared `async`
} }
@ -23,16 +23,16 @@ fn main() {
macro_rules! accept_item { ($x:item) => {} } macro_rules! accept_item { ($x:item) => {} }
accept_item! { accept_item! {
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
} }
accept_item! { accept_item! {
impl Foo { impl Foo {
async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
} }
} }
let inside_closure = || { let inside_closure = || {
async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
}; };
} }

View file

@ -1,4 +1,4 @@
error[E0670]: `async fn` is not permitted in the 2015 edition error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/edition-deny-async-fns-2015.rs:3:1 --> $DIR/edition-deny-async-fns-2015.rs:3:1
| |
LL | async fn foo() {} LL | async fn foo() {}
@ -7,7 +7,7 @@ LL | async fn foo() {}
= help: set `edition = "2018"` in `Cargo.toml` = help: set `edition = "2018"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide = note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in the 2015 edition error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/edition-deny-async-fns-2015.rs:5:12 --> $DIR/edition-deny-async-fns-2015.rs:5:12
| |
LL | fn baz() { async fn foo() {} } LL | fn baz() { async fn foo() {} }
@ -16,7 +16,7 @@ LL | fn baz() { async fn foo() {} }
= help: set `edition = "2018"` in `Cargo.toml` = help: set `edition = "2018"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide = note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in the 2015 edition error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/edition-deny-async-fns-2015.rs:7:1 --> $DIR/edition-deny-async-fns-2015.rs:7:1
| |
LL | async fn async_baz() { LL | async fn async_baz() {
@ -25,7 +25,7 @@ LL | async fn async_baz() {
= help: set `edition = "2018"` in `Cargo.toml` = help: set `edition = "2018"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide = note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in the 2015 edition error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/edition-deny-async-fns-2015.rs:8:5 --> $DIR/edition-deny-async-fns-2015.rs:8:5
| |
LL | async fn bar() {} LL | async fn bar() {}
@ -34,7 +34,7 @@ LL | async fn bar() {}
= help: set `edition = "2018"` in `Cargo.toml` = help: set `edition = "2018"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide = note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in the 2015 edition error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/edition-deny-async-fns-2015.rs:14:5 --> $DIR/edition-deny-async-fns-2015.rs:14:5
| |
LL | async fn foo() {} LL | async fn foo() {}
@ -43,7 +43,7 @@ LL | async fn foo() {}
= help: set `edition = "2018"` in `Cargo.toml` = help: set `edition = "2018"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide = note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in the 2015 edition error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/edition-deny-async-fns-2015.rs:18:5 --> $DIR/edition-deny-async-fns-2015.rs:18:5
| |
LL | async fn foo() {} LL | async fn foo() {}
@ -52,7 +52,7 @@ LL | async fn foo() {}
= help: set `edition = "2018"` in `Cargo.toml` = help: set `edition = "2018"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide = note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in the 2015 edition error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/edition-deny-async-fns-2015.rs:36:9 --> $DIR/edition-deny-async-fns-2015.rs:36:9
| |
LL | async fn bar() {} LL | async fn bar() {}
@ -61,7 +61,7 @@ LL | async fn bar() {}
= help: set `edition = "2018"` in `Cargo.toml` = help: set `edition = "2018"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide = note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in the 2015 edition error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/edition-deny-async-fns-2015.rs:26:9 --> $DIR/edition-deny-async-fns-2015.rs:26:9
| |
LL | async fn foo() {} LL | async fn foo() {}
@ -70,7 +70,7 @@ LL | async fn foo() {}
= help: set `edition = "2018"` in `Cargo.toml` = help: set `edition = "2018"` in `Cargo.toml`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide = note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in the 2015 edition error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/edition-deny-async-fns-2015.rs:31:13 --> $DIR/edition-deny-async-fns-2015.rs:31:13
| |
LL | async fn bar() {} LL | async fn bar() {}

View file

@ -1,13 +1,13 @@
async fn foo() { async fn foo() {
//~^ ERROR `async fn` is not permitted in the 2015 edition //~^ ERROR `async fn` is not permitted in Rust 2015
//~| NOTE to use `async fn`, switch to Rust 2018 or later //~| NOTE to use `async fn`, switch to Rust 2018 or later
//~| HELP set `edition = "2018"` in `Cargo.toml` //~| HELP set `edition = "2018"` in `Cargo.toml`
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
let x = async {}; let x = async {};
//~^ ERROR cannot find struct, variant or union type `async` in this scope //~^ ERROR cannot find struct, variant or union type `async` in this scope
//~| NOTE `async` blocks are only allowed in the 2018 edition //~| NOTE `async` blocks are only allowed in Rust 2018 or later
let y = async { //~ NOTE `async` blocks are only allowed in edition 2018 or later let y = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
let x = 42; let x = 42;
//~^ ERROR expected identifier, found keyword `let` //~^ ERROR expected identifier, found keyword `let`
//~| NOTE expected identifier, found keyword //~| NOTE expected identifier, found keyword
@ -15,7 +15,7 @@ async fn foo() {
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
42 42
}; };
let z = async { //~ NOTE `async` blocks are only allowed in edition 2018 or later let z = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
42 42
//~^ ERROR expected identifier, found `42` //~^ ERROR expected identifier, found `42`
//~| NOTE expected identifier //~| NOTE expected identifier

View file

@ -1,4 +1,4 @@
error[E0670]: `async fn` is not permitted in the 2015 edition error[E0670]: `async fn` is not permitted in Rust 2015
--> $DIR/async-block-2015.rs:1:1 --> $DIR/async-block-2015.rs:1:1
| |
LL | async fn foo() { LL | async fn foo() {
@ -11,7 +11,7 @@ error: expected identifier, found keyword `let`
--> $DIR/async-block-2015.rs:11:9 --> $DIR/async-block-2015.rs:11:9
| |
LL | let y = async { LL | let y = async {
| ----- `async` blocks are only allowed in edition 2018 or later | ----- `async` blocks are only allowed in Rust 2018 or later
LL | let x = 42; LL | let x = 42;
| ^^^ expected identifier, found keyword | ^^^ expected identifier, found keyword
| |
@ -22,7 +22,7 @@ error: expected identifier, found `42`
--> $DIR/async-block-2015.rs:19:9 --> $DIR/async-block-2015.rs:19:9
| |
LL | let z = async { LL | let z = async {
| ----- `async` blocks are only allowed in edition 2018 or later | ----- `async` blocks are only allowed in Rust 2018 or later
LL | 42 LL | 42
| ^^ expected identifier | ^^ expected identifier
| |
@ -33,7 +33,7 @@ error[E0422]: cannot find struct, variant or union type `async` in this scope
--> $DIR/async-block-2015.rs:7:13 --> $DIR/async-block-2015.rs:7:13
| |
LL | let x = async {}; LL | let x = async {};
| ^^^^^ `async` blocks are only allowed in the 2018 edition | ^^^^^ `async` blocks are only allowed in Rust 2018 or later
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -13,7 +13,7 @@ error[E0574]: expected struct, variant or union type, found macro `try`
LL | let try_result: Option<_> = try { LL | let try_result: Option<_> = try {
| ^^^ not a struct, variant or union type | ^^^ not a struct, variant or union type
| |
= note: if you want the `try` keyword, you need to be in the 2018 edition = note: if you want the `try` keyword, you need Rust 2018 or later
help: use `!` to invoke the macro help: use `!` to invoke the macro
| |
LL | let try_result: Option<_> = try! { LL | let try_result: Option<_> = try! {