Extend test to trigger on 2015, 2018 and 2021 editions

This commit is contained in:
Esteban Küber 2024-03-14 00:22:52 +00:00
parent 999a0dc300
commit 6f388ef1fb
5 changed files with 48 additions and 8 deletions

View File

@ -1,4 +0,0 @@
//@ run-rustfix
fn main() {
println!("hello world"); //~ ERROR unterminated character literal
}

View File

@ -1,4 +1,8 @@
//@ run-rustfix //@ revisions: rust2015 rust2018 rust2021
//@[rust2018] edition:2018
//@[rust2021] edition:2021
fn main() { fn main() {
println!('hello world'); //~ ERROR unterminated character literal println!('hello world');
//[rust2015,rust2018,rust2021]~^ ERROR unterminated character literal
//[rust2021]~^^ ERROR prefix `world` is unknown
} }

View File

@ -1,8 +1,8 @@
error[E0762]: unterminated character literal error[E0762]: unterminated character literal
--> $DIR/lex-bad-str-literal-as-char-3.rs:3:26 --> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
| |
LL | println!('hello world'); LL | println!('hello world');
| ^^^^ | ^^^
| |
help: if you meant to write a string literal, use double quotes help: if you meant to write a string literal, use double quotes
| |

View File

@ -0,0 +1,14 @@
error[E0762]: unterminated character literal
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
|
LL | println!('hello world');
| ^^^
|
help: if you meant to write a string literal, use double quotes
|
LL | println!("hello world");
| ~ ~
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0762`.

View File

@ -0,0 +1,26 @@
error: prefix `world` is unknown
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:21
|
LL | println!('hello world');
| ^^^^^ unknown prefix
|
= note: prefixed identifiers and literals are reserved since Rust 2021
help: if you meant to write a string literal, use double quotes
|
LL | println!("hello world");
| ~ ~
error[E0762]: unterminated character literal
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
|
LL | println!('hello world');
| ^^^
|
help: if you meant to write a string literal, use double quotes
|
LL | println!("hello world");
| ~ ~
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0762`.