Suggest br if the unknown string prefix rb is found
This commit is contained in:
parent
fc24bcead1
commit
f2c9654dcd
3 changed files with 41 additions and 3 deletions
10
src/test/ui/suggestions/raw-byte-string-prefix.rs
Normal file
10
src/test/ui/suggestions/raw-byte-string-prefix.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// `br` and `rb` are easy to confuse; check that we issue a suggestion to help.
|
||||
|
||||
// edition:2021
|
||||
|
||||
fn main() {
|
||||
rb"abc";
|
||||
//~^ ERROR: prefix `rb` is unknown
|
||||
//~| HELP: use `br` for a raw byte string
|
||||
//~| ERROR: expected one of
|
||||
}
|
||||
20
src/test/ui/suggestions/raw-byte-string-prefix.stderr
Normal file
20
src/test/ui/suggestions/raw-byte-string-prefix.stderr
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
error: prefix `rb` is unknown
|
||||
--> $DIR/raw-byte-string-prefix.rs:6:5
|
||||
|
|
||||
LL | rb"abc";
|
||||
| ^^ unknown prefix
|
||||
|
|
||||
= note: prefixed identifiers and literals are reserved since Rust 2021
|
||||
help: use `br` for a raw byte string
|
||||
|
|
||||
LL | br"abc";
|
||||
| ^^
|
||||
|
||||
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"abc"`
|
||||
--> $DIR/raw-byte-string-prefix.rs:6:7
|
||||
|
|
||||
LL | rb"abc";
|
||||
| ^^^^^ expected one of 8 possible tokens
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue