about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorRyan Cumming <etaoins@gmail.com>2018-01-15 08:08:22 +1100
committerRyan Cumming <etaoins@gmail.com>2018-01-15 18:09:52 +1100
commitecd47a91c7c5eb22fba5fcdec7fa8d78a8bcac51 (patch)
treeb2c8c75233fe960eb97ab22a0baa207e8609dee2 /src/test/ui
parentbb345a0be3ba3fa1970fe02789791c5c72788d8f (diff)
downloadrust-ecd47a91c7c5eb22fba5fcdec7fa8d78a8bcac51.tar.gz
rust-ecd47a91c7c5eb22fba5fcdec7fa8d78a8bcac51.zip
Don't include bang in macro replacement suggestion
When we suggest the replacement for a macro we include the "!" in the
suggested replacement but the span only contains the name of the macro
itself. Using that replacement would cause a duplicate "!" in the
resulting code.

I originally tried to extend the span to be replaced by 1 byte in
rust-lang/rust#47424. However, @zackmdavis pointed out that there can be
whitespace between the macro name and the bang.

Instead, just remove the bang from the suggested replacement.

Fixes #47418
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/macros/macro-name-typo.stderr2
-rw-r--r--src/test/ui/macros/macro_undefined.stderr2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/test/ui/macros/macro-name-typo.stderr b/src/test/ui/macros/macro-name-typo.stderr
index 84851749c70..ebe95356c26 100644
--- a/src/test/ui/macros/macro-name-typo.stderr
+++ b/src/test/ui/macros/macro-name-typo.stderr
@@ -2,7 +2,7 @@ error: cannot find macro `printlx!` in this scope
   --> $DIR/macro-name-typo.rs:12:5
    |
 12 |     printlx!("oh noes!"); //~ ERROR cannot find
-   |     ^^^^^^^ help: you could try the macro: `println!`
+   |     ^^^^^^^ help: you could try the macro: `println`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/macros/macro_undefined.stderr b/src/test/ui/macros/macro_undefined.stderr
index 6cfb05e7867..8d6da6a4732 100644
--- a/src/test/ui/macros/macro_undefined.stderr
+++ b/src/test/ui/macros/macro_undefined.stderr
@@ -10,7 +10,7 @@ error: cannot find macro `k!` in this scope
   --> $DIR/macro_undefined.rs:21:5
    |
 21 |     k!(); //~ ERROR cannot find
-   |     ^ help: you could try the macro: `kl!`
+   |     ^ help: you could try the macro: `kl`
 
 error: aborting due to 2 previous errors