Skip to content

Commit c574ded

Browse files
committed
Consistently call editions "Rust 20xx" in messages.
1 parent f16ef7d commit c574ded

File tree

8 files changed

+31
-31
lines changed

8 files changed

+31
-31
lines changed

compiler/rustc_parse/src/parser/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2109,7 +2109,7 @@ impl<'a> Parser<'a> {
21092109

21102110
let mut async_block_err = |e: &mut DiagnosticBuilder<'_>, span: Span| {
21112111
recover_async = true;
2112-
e.span_label(span, "`async` blocks are only allowed in edition 2018 or later");
2112+
e.span_label(span, "`async` blocks are only allowed in Rust 2018 or later");
21132113
e.help(&format!("set `edition = \"{}\"` in `Cargo.toml`", LATEST_STABLE_EDITION));
21142114
e.note("for more on editions, read https://doc.rust-lang.org/edition-guide");
21152115
};

compiler/rustc_parse/src/parser/item.rs

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

compiler/rustc_resolve/src/late/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
180180
(
181181
format!("cannot find {} `{}` in {}{}", expected, item_str, mod_prefix, mod_str),
182182
if path_str == "async" && expected.starts_with("struct") {
183-
"`async` blocks are only allowed in the 2018 edition".to_string()
183+
"`async` blocks are only allowed in Rust 2018 or later".to_string()
184184
} else {
185185
format!("not found in {}", mod_str)
186186
},
@@ -904,7 +904,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
904904
Applicability::MaybeIncorrect,
905905
);
906906
if path_str == "try" && span.rust_2015() {
907-
err.note("if you want the `try` keyword, you need to be in the 2018 edition");
907+
err.note("if you want the `try` keyword, you need Rust 2018 or later");
908908
}
909909
}
910910
(Res::Def(DefKind::TyAlias, def_id), PathSource::Trait(_)) => {
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
// edition:2015
22

3-
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
3+
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
44

5-
fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in the 2015 edition
5+
fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in Rust 2015
66

7-
async fn async_baz() { //~ ERROR `async fn` is not permitted in the 2015 edition
8-
async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition
7+
async fn async_baz() { //~ ERROR `async fn` is not permitted in Rust 2015
8+
async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
99
}
1010

1111
struct Foo {}
1212

1313
impl Foo {
14-
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
14+
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
1515
}
1616

1717
trait Bar {
18-
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
18+
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
1919
//~^ ERROR functions in traits cannot be declared `async`
2020
}
2121

2222
fn main() {
2323
macro_rules! accept_item { ($x:item) => {} }
2424

2525
accept_item! {
26-
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
26+
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
2727
}
2828

2929
accept_item! {
3030
impl Foo {
31-
async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition
31+
async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
3232
}
3333
}
3434

3535
let inside_closure = || {
36-
async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition
36+
async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
3737
};
3838
}

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0670]: `async fn` is not permitted in the 2015 edition
1+
error[E0670]: `async fn` is not permitted in Rust 2015
22
--> $DIR/edition-deny-async-fns-2015.rs:3:1
33
|
44
LL | async fn foo() {}
@@ -7,7 +7,7 @@ LL | async fn foo() {}
77
= help: set `edition = "2018"` in `Cargo.toml`
88
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
99

10-
error[E0670]: `async fn` is not permitted in the 2015 edition
10+
error[E0670]: `async fn` is not permitted in Rust 2015
1111
--> $DIR/edition-deny-async-fns-2015.rs:5:12
1212
|
1313
LL | fn baz() { async fn foo() {} }
@@ -16,7 +16,7 @@ LL | fn baz() { async fn foo() {} }
1616
= help: set `edition = "2018"` in `Cargo.toml`
1717
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
1818

19-
error[E0670]: `async fn` is not permitted in the 2015 edition
19+
error[E0670]: `async fn` is not permitted in Rust 2015
2020
--> $DIR/edition-deny-async-fns-2015.rs:7:1
2121
|
2222
LL | async fn async_baz() {
@@ -25,7 +25,7 @@ LL | async fn async_baz() {
2525
= help: set `edition = "2018"` in `Cargo.toml`
2626
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
2727

28-
error[E0670]: `async fn` is not permitted in the 2015 edition
28+
error[E0670]: `async fn` is not permitted in Rust 2015
2929
--> $DIR/edition-deny-async-fns-2015.rs:8:5
3030
|
3131
LL | async fn bar() {}
@@ -34,7 +34,7 @@ LL | async fn bar() {}
3434
= help: set `edition = "2018"` in `Cargo.toml`
3535
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
3636

37-
error[E0670]: `async fn` is not permitted in the 2015 edition
37+
error[E0670]: `async fn` is not permitted in Rust 2015
3838
--> $DIR/edition-deny-async-fns-2015.rs:14:5
3939
|
4040
LL | async fn foo() {}
@@ -43,7 +43,7 @@ LL | async fn foo() {}
4343
= help: set `edition = "2018"` in `Cargo.toml`
4444
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
4545

46-
error[E0670]: `async fn` is not permitted in the 2015 edition
46+
error[E0670]: `async fn` is not permitted in Rust 2015
4747
--> $DIR/edition-deny-async-fns-2015.rs:18:5
4848
|
4949
LL | async fn foo() {}
@@ -52,7 +52,7 @@ LL | async fn foo() {}
5252
= help: set `edition = "2018"` in `Cargo.toml`
5353
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
5454

55-
error[E0670]: `async fn` is not permitted in the 2015 edition
55+
error[E0670]: `async fn` is not permitted in Rust 2015
5656
--> $DIR/edition-deny-async-fns-2015.rs:36:9
5757
|
5858
LL | async fn bar() {}
@@ -61,7 +61,7 @@ LL | async fn bar() {}
6161
= help: set `edition = "2018"` in `Cargo.toml`
6262
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
6363

64-
error[E0670]: `async fn` is not permitted in the 2015 edition
64+
error[E0670]: `async fn` is not permitted in Rust 2015
6565
--> $DIR/edition-deny-async-fns-2015.rs:26:9
6666
|
6767
LL | async fn foo() {}
@@ -70,7 +70,7 @@ LL | async fn foo() {}
7070
= help: set `edition = "2018"` in `Cargo.toml`
7171
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
7272

73-
error[E0670]: `async fn` is not permitted in the 2015 edition
73+
error[E0670]: `async fn` is not permitted in Rust 2015
7474
--> $DIR/edition-deny-async-fns-2015.rs:31:13
7575
|
7676
LL | async fn bar() {}

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

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

77
let x = async {};
88
//~^ ERROR cannot find struct, variant or union type `async` in this scope
9-
//~| NOTE `async` blocks are only allowed in the 2018 edition
10-
let y = async { //~ NOTE `async` blocks are only allowed in edition 2018 or later
9+
//~| NOTE `async` blocks are only allowed in Rust 2018 or later
10+
let y = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
1111
let x = 42;
1212
//~^ ERROR expected identifier, found keyword `let`
1313
//~| NOTE expected identifier, found keyword
1414
//~| HELP set `edition = "2018"` in `Cargo.toml`
1515
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
1616
42
1717
};
18-
let z = async { //~ NOTE `async` blocks are only allowed in edition 2018 or later
18+
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

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0670]: `async fn` is not permitted in the 2015 edition
1+
error[E0670]: `async fn` is not permitted in Rust 2015
22
--> $DIR/async-block-2015.rs:1:1
33
|
44
LL | async fn foo() {
@@ -11,7 +11,7 @@ error: expected identifier, found keyword `let`
1111
--> $DIR/async-block-2015.rs:11:9
1212
|
1313
LL | let y = async {
14-
| ----- `async` blocks are only allowed in edition 2018 or later
14+
| ----- `async` blocks are only allowed in Rust 2018 or later
1515
LL | let x = 42;
1616
| ^^^ expected identifier, found keyword
1717
|
@@ -22,7 +22,7 @@ error: expected identifier, found `42`
2222
--> $DIR/async-block-2015.rs:19:9
2323
|
2424
LL | let z = async {
25-
| ----- `async` blocks are only allowed in edition 2018 or later
25+
| ----- `async` blocks are only allowed in Rust 2018 or later
2626
LL | 42
2727
| ^^ expected identifier
2828
|
@@ -33,7 +33,7 @@ error[E0422]: cannot find struct, variant or union type `async` in this scope
3333
--> $DIR/async-block-2015.rs:7:13
3434
|
3535
LL | let x = async {};
36-
| ^^^^^ `async` blocks are only allowed in the 2018 edition
36+
| ^^^^^ `async` blocks are only allowed in Rust 2018 or later
3737

3838
error: aborting due to 4 previous errors
3939

src/test/ui/try-block/try-block-in-edition2015.stderr

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

0 commit comments

Comments
 (0)