Consistently call editions "Rust 20xx" in messages.
This commit is contained in:
parent
f16ef7d7ce
commit
c574ded57d
@ -2109,7 +2109,7 @@ 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 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.note("for more on editions, read https://doc.rust-lang.org/edition-guide");
|
||||
};
|
||||
|
@ -1667,7 +1667,7 @@ impl<'a> Parser<'a> {
|
||||
fn ban_async_in_2015(&self, span: Span) {
|
||||
if span.rust_2015() {
|
||||
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")
|
||||
.help(&format!("set `edition = \"{}\"` in `Cargo.toml`", LATEST_STABLE_EDITION))
|
||||
.note("for more on editions, read https://doc.rust-lang.org/edition-guide")
|
||||
|
@ -180,7 +180,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
||||
(
|
||||
format!("cannot find {} `{}` in {}{}", expected, item_str, mod_prefix, mod_str),
|
||||
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 {
|
||||
format!("not found in {}", mod_str)
|
||||
},
|
||||
@ -904,7 +904,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
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(_)) => {
|
||||
|
@ -1,21 +1,21 @@
|
||||
// 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 bar() {} //~ 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 Rust 2015
|
||||
}
|
||||
|
||||
struct 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 {
|
||||
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`
|
||||
}
|
||||
|
||||
@ -23,16 +23,16 @@ fn main() {
|
||||
macro_rules! accept_item { ($x: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! {
|
||||
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 = || {
|
||||
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
|
||||
};
|
||||
}
|
||||
|
@ -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
|
||||
|
|
||||
LL | async fn foo() {}
|
||||
@ -7,7 +7,7 @@ LL | async fn foo() {}
|
||||
= help: set `edition = "2018"` in `Cargo.toml`
|
||||
= 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
|
||||
|
|
||||
LL | fn baz() { async fn foo() {} }
|
||||
@ -16,7 +16,7 @@ LL | fn baz() { async fn foo() {} }
|
||||
= help: set `edition = "2018"` in `Cargo.toml`
|
||||
= 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
|
||||
|
|
||||
LL | async fn async_baz() {
|
||||
@ -25,7 +25,7 @@ LL | async fn async_baz() {
|
||||
= help: set `edition = "2018"` in `Cargo.toml`
|
||||
= 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
|
||||
|
|
||||
LL | async fn bar() {}
|
||||
@ -34,7 +34,7 @@ LL | async fn bar() {}
|
||||
= help: set `edition = "2018"` in `Cargo.toml`
|
||||
= 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
|
||||
|
|
||||
LL | async fn foo() {}
|
||||
@ -43,7 +43,7 @@ LL | async fn foo() {}
|
||||
= help: set `edition = "2018"` in `Cargo.toml`
|
||||
= 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
|
||||
|
|
||||
LL | async fn foo() {}
|
||||
@ -52,7 +52,7 @@ LL | async fn foo() {}
|
||||
= help: set `edition = "2018"` in `Cargo.toml`
|
||||
= 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
|
||||
|
|
||||
LL | async fn bar() {}
|
||||
@ -61,7 +61,7 @@ LL | async fn bar() {}
|
||||
= help: set `edition = "2018"` in `Cargo.toml`
|
||||
= 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
|
||||
|
|
||||
LL | async fn foo() {}
|
||||
@ -70,7 +70,7 @@ LL | async fn foo() {}
|
||||
= help: set `edition = "2018"` in `Cargo.toml`
|
||||
= 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
|
||||
|
|
||||
LL | async fn bar() {}
|
||||
|
@ -1,13 +1,13 @@
|
||||
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
|
||||
//~| HELP set `edition = "2018"` in `Cargo.toml`
|
||||
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||
|
||||
let x = async {};
|
||||
//~^ ERROR cannot find struct, variant or union type `async` in this scope
|
||||
//~| NOTE `async` blocks are only allowed in the 2018 edition
|
||||
let y = async { //~ NOTE `async` blocks are only allowed in edition 2018 or later
|
||||
//~| NOTE `async` blocks are only allowed in Rust 2018 or later
|
||||
let y = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
|
||||
let x = 42;
|
||||
//~^ ERROR expected identifier, found keyword `let`
|
||||
//~| 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
|
||||
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
|
||||
//~^ ERROR expected identifier, found `42`
|
||||
//~| NOTE expected identifier
|
||||
|
@ -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
|
||||
|
|
||||
LL | async fn foo() {
|
||||
@ -11,7 +11,7 @@ error: expected identifier, found keyword `let`
|
||||
--> $DIR/async-block-2015.rs:11:9
|
||||
|
|
||||
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;
|
||||
| ^^^ expected identifier, found keyword
|
||||
|
|
||||
@ -22,7 +22,7 @@ error: expected identifier, found `42`
|
||||
--> $DIR/async-block-2015.rs:19:9
|
||||
|
|
||||
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
|
||||
| ^^ 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
|
||||
|
|
||||
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
|
||||
|
||||
|
@ -13,7 +13,7 @@ error[E0574]: expected struct, variant or union type, found macro `try`
|
||||
LL | let try_result: Option<_> = try {
|
||||
| ^^^ 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
|
||||
|
|
||||
LL | let try_result: Option<_> = try! {
|
||||
|
Loading…
x
Reference in New Issue
Block a user