Skip to content

Commit 6f388ef

Browse files
committed
Extend test to trigger on 2015, 2018 and 2021 editions
1 parent 999a0dc commit 6f388ef

5 files changed

+48
-8
lines changed

tests/ui/lexer/lex-bad-str-literal-as-char-3.fixed

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
//@ run-rustfix
1+
//@ revisions: rust2015 rust2018 rust2021
2+
//@[rust2018] edition:2018
3+
//@[rust2021] edition:2021
24
fn main() {
3-
println!('hello world'); //~ ERROR unterminated character literal
5+
println!('hello world');
6+
//[rust2015,rust2018,rust2021]~^ ERROR unterminated character literal
7+
//[rust2021]~^^ ERROR prefix `world` is unknown
48
}

tests/ui/lexer/lex-bad-str-literal-as-char-3.stderr renamed to tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0762]: unterminated character literal
2-
--> $DIR/lex-bad-str-literal-as-char-3.rs:3:26
2+
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
33
|
44
LL | println!('hello world');
5-
| ^^^^
5+
| ^^^
66
|
77
help: if you meant to write a string literal, use double quotes
88
|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0762]: unterminated character literal
2+
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
3+
|
4+
LL | println!('hello world');
5+
| ^^^
6+
|
7+
help: if you meant to write a string literal, use double quotes
8+
|
9+
LL | println!("hello world");
10+
| ~ ~
11+
12+
error: aborting due to 1 previous error
13+
14+
For more information about this error, try `rustc --explain E0762`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: prefix `world` is unknown
2+
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:21
3+
|
4+
LL | println!('hello world');
5+
| ^^^^^ unknown prefix
6+
|
7+
= note: prefixed identifiers and literals are reserved since Rust 2021
8+
help: if you meant to write a string literal, use double quotes
9+
|
10+
LL | println!("hello world");
11+
| ~ ~
12+
13+
error[E0762]: unterminated character literal
14+
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
15+
|
16+
LL | println!('hello world');
17+
| ^^^
18+
|
19+
help: if you meant to write a string literal, use double quotes
20+
|
21+
LL | println!("hello world");
22+
| ~ ~
23+
24+
error: aborting due to 2 previous errors
25+
26+
For more information about this error, try `rustc --explain E0762`.

0 commit comments

Comments
 (0)