about summary refs log tree commit diff
path: root/tests/ui/lexer
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-07-09 22:30:26 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-02-10 20:21:39 +0000
commitf0845adb0c1b7a7fa1bef73e749b2d7e1d7f374d (patch)
treee97d87013709bda13934fdc452a2a459a069876a /tests/ui/lexer
parent8c04e395952022a451138dc4dbead6dd6ae65203 (diff)
downloadrust-f0845adb0c1b7a7fa1bef73e749b2d7e1d7f374d.tar.gz
rust-f0845adb0c1b7a7fa1bef73e749b2d7e1d7f374d.zip
Show diff suggestion format on verbose replacement
```
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
  --> $DIR/attempted-access-non-fatal.rs:7:15
   |
LL |     let _ = 2.l;
   |               ^
   |
help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix
   |
LL -     let _ = 2.l;
LL +     let _ = 2.0f64;
   |
```
Diffstat (limited to 'tests/ui/lexer')
-rw-r--r--tests/ui/lexer/lex-bad-char-literals-1.stderr10
-rw-r--r--tests/ui/lexer/lex-bad-char-literals-2.stderr5
-rw-r--r--tests/ui/lexer/lex-bad-char-literals-3.stderr10
-rw-r--r--tests/ui/lexer/lex-bad-char-literals-5.stderr10
-rw-r--r--tests/ui/lexer/lex-bad-char-literals-6.stderr15
-rw-r--r--tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr5
-rw-r--r--tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr5
-rw-r--r--tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr5
-rw-r--r--tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr5
-rw-r--r--tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr10
-rw-r--r--tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr10
11 files changed, 54 insertions, 36 deletions
diff --git a/tests/ui/lexer/lex-bad-char-literals-1.stderr b/tests/ui/lexer/lex-bad-char-literals-1.stderr
index 9dc0a338063..49683c10237 100644
--- a/tests/ui/lexer/lex-bad-char-literals-1.stderr
+++ b/tests/ui/lexer/lex-bad-char-literals-1.stderr
@@ -19,8 +19,9 @@ LL |     '\●'
    = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
 help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
    |
-LL |     r"\●"
-   |     ~~~~~
+LL -     '\●'
+LL +     r"\●"
+   |
 
 error: unknown character escape: `\u{25cf}`
   --> $DIR/lex-bad-char-literals-1.rs:14:7
@@ -31,8 +32,9 @@ LL |     "\●"
    = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
 help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
    |
-LL |     r"\●"
-   |     ~~~~~
+LL -     "\●"
+LL +     r"\●"
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/lexer/lex-bad-char-literals-2.stderr b/tests/ui/lexer/lex-bad-char-literals-2.stderr
index 76cde00404a..fa063072865 100644
--- a/tests/ui/lexer/lex-bad-char-literals-2.stderr
+++ b/tests/ui/lexer/lex-bad-char-literals-2.stderr
@@ -6,8 +6,9 @@ LL |     'nope'
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     "nope"
-   |     ~    ~
+LL -     'nope'
+LL +     "nope"
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/lexer/lex-bad-char-literals-3.stderr b/tests/ui/lexer/lex-bad-char-literals-3.stderr
index 3f339b2ef7d..d8ce17d13a9 100644
--- a/tests/ui/lexer/lex-bad-char-literals-3.stderr
+++ b/tests/ui/lexer/lex-bad-char-literals-3.stderr
@@ -6,8 +6,9 @@ LL | static c: char = '●●';
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL | static c: char = "●●";
-   |                  ~  ~
+LL - static c: char = '●●';
+LL + static c: char = "●●";
+   |
 
 error: character literal may only contain one codepoint
   --> $DIR/lex-bad-char-literals-3.rs:5:20
@@ -17,8 +18,9 @@ LL |     let ch: &str = '●●';
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     let ch: &str = "●●";
-   |                    ~  ~
+LL -     let ch: &str = '●●';
+LL +     let ch: &str = "●●";
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/lexer/lex-bad-char-literals-5.stderr b/tests/ui/lexer/lex-bad-char-literals-5.stderr
index 8004157e87f..0322783871e 100644
--- a/tests/ui/lexer/lex-bad-char-literals-5.stderr
+++ b/tests/ui/lexer/lex-bad-char-literals-5.stderr
@@ -6,8 +6,9 @@ LL | static c: char = '\x10\x10';
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL | static c: char = "\x10\x10";
-   |                  ~        ~
+LL - static c: char = '\x10\x10';
+LL + static c: char = "\x10\x10";
+   |
 
 error: character literal may only contain one codepoint
   --> $DIR/lex-bad-char-literals-5.rs:5:20
@@ -17,8 +18,9 @@ LL |     let ch: &str = '\x10\x10';
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     let ch: &str = "\x10\x10";
-   |                    ~        ~
+LL -     let ch: &str = '\x10\x10';
+LL +     let ch: &str = "\x10\x10";
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/lexer/lex-bad-char-literals-6.stderr b/tests/ui/lexer/lex-bad-char-literals-6.stderr
index 96d409d59bb..e5fd62bc0a9 100644
--- a/tests/ui/lexer/lex-bad-char-literals-6.stderr
+++ b/tests/ui/lexer/lex-bad-char-literals-6.stderr
@@ -6,8 +6,9 @@ LL |     let x: &str = 'ab';
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     let x: &str = "ab";
-   |                   ~  ~
+LL -     let x: &str = 'ab';
+LL +     let x: &str = "ab";
+   |
 
 error: character literal may only contain one codepoint
   --> $DIR/lex-bad-char-literals-6.rs:4:19
@@ -17,8 +18,9 @@ LL |     let y: char = 'cd';
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     let y: char = "cd";
-   |                   ~  ~
+LL -     let y: char = 'cd';
+LL +     let y: char = "cd";
+   |
 
 error: character literal may only contain one codepoint
   --> $DIR/lex-bad-char-literals-6.rs:6:13
@@ -28,8 +30,9 @@ LL |     let z = 'ef';
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     let z = "ef";
-   |             ~  ~
+LL -     let z = 'ef';
+LL +     let z = "ef";
+   |
 
 error[E0308]: mismatched types
   --> $DIR/lex-bad-char-literals-6.rs:13:20
diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr
index 57c5f82704e..81ee697802b 100644
--- a/tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr
+++ b/tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr
@@ -6,8 +6,9 @@ LL |     println!('1 + 1');
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     println!("1 + 1");
-   |              ~     ~
+LL -     println!('1 + 1');
+LL +     println!("1 + 1");
+   |
 
 error: lifetimes cannot start with a number
   --> $DIR/lex-bad-str-literal-as-char-1.rs:3:14
diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr
index f64761af641..ed1303cd428 100644
--- a/tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr
+++ b/tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr
@@ -6,8 +6,9 @@ LL |     println!(' 1 + 1');
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     println!(" 1 + 1");
-   |              ~      ~
+LL -     println!(' 1 + 1');
+LL +     println!(" 1 + 1");
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr
index 06f12742667..2f92225de1f 100644
--- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr
+++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr
@@ -6,8 +6,9 @@ LL |     println!('hello world');
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     println!("hello world");
-   |              ~           ~
+LL -     println!('hello world');
+LL +     println!("hello world");
+   |
 
 error: aborting due to 1 previous error
 
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
index 06f12742667..2f92225de1f 100644
--- 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
@@ -6,8 +6,9 @@ LL |     println!('hello world');
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     println!("hello world");
-   |              ~           ~
+LL -     println!('hello world');
+LL +     println!("hello world");
+   |
 
 error: aborting due to 1 previous error
 
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
index 4170560cfcb..e10046e58e4 100644
--- 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
@@ -7,8 +7,9 @@ LL |     println!('hello world');
    = 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");
-   |              ~           ~
+LL -     println!('hello world');
+LL +     println!("hello world");
+   |
 
 error[E0762]: unterminated character literal
   --> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
@@ -18,8 +19,9 @@ LL |     println!('hello world');
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     println!("hello world");
-   |              ~           ~
+LL -     println!('hello world');
+LL +     println!("hello world");
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr
index af42b5b7f7b..5633783e738 100644
--- a/tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr
+++ b/tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr
@@ -7,8 +7,9 @@ LL |         println!('hello world');
    = 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");
-   |                  ~           ~
+LL -         println!('hello world');
+LL +         println!("hello world");
+   |
 
 error[E0762]: unterminated character literal
   --> $DIR/lex-bad-str-literal-as-char-4.rs:4:30
@@ -18,8 +19,9 @@ LL |         println!('hello world');
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |         println!("hello world");
-   |                  ~           ~
+LL -         println!('hello world');
+LL +         println!("hello world");
+   |
 
 error: aborting due to 2 previous errors