diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-03-14 00:22:52 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-03-17 23:35:19 +0000 |
| commit | 6f388ef1fb3964fb83bae5c277f9c83bbde4c76b (patch) | |
| tree | 25489a46497fee7f062461e92514a337dead0851 /tests/ui/lexer | |
| parent | 999a0dc300b7f95eb7d83666514c4ceae76020f2 (diff) | |
| download | rust-6f388ef1fb3964fb83bae5c277f9c83bbde4c76b.tar.gz rust-6f388ef1fb3964fb83bae5c277f9c83bbde4c76b.zip | |
Extend test to trigger on 2015, 2018 and 2021 editions
Diffstat (limited to 'tests/ui/lexer')
| -rw-r--r-- | tests/ui/lexer/lex-bad-str-literal-as-char-3.fixed | 4 | ||||
| -rw-r--r-- | tests/ui/lexer/lex-bad-str-literal-as-char-3.rs | 8 | ||||
| -rw-r--r-- | tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr (renamed from tests/ui/lexer/lex-bad-str-literal-as-char-3.stderr) | 4 | ||||
| -rw-r--r-- | tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr | 14 | ||||
| -rw-r--r-- | tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr | 26 |
5 files changed, 48 insertions, 8 deletions
diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.fixed b/tests/ui/lexer/lex-bad-str-literal-as-char-3.fixed deleted file mode 100644 index 3fbe0ea1dab..00000000000 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.fixed +++ /dev/null @@ -1,4 +0,0 @@ -//@ run-rustfix -fn main() { - println!("hello world"); //~ ERROR unterminated character literal -} diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rs b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rs index 289f3f1d657..2c0eda97853 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rs +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rs @@ -1,4 +1,8 @@ -//@ run-rustfix +//@ revisions: rust2015 rust2018 rust2021 +//@[rust2018] edition:2018 +//@[rust2021] edition:2021 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 } diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr index 262f7856983..06f12742667 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr @@ -1,8 +1,8 @@ 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'); - | ^^^^ + | ^^^ | help: if you meant to write a string literal, use double quotes | diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr new file mode 100644 index 00000000000..06f12742667 --- /dev/null +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr @@ -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`. diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr new file mode 100644 index 00000000000..4170560cfcb --- /dev/null +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr @@ -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`. |
