Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit c856e6f

Browse files
m-ou-selrh2000
authored andcommitted
Add machine applicable suggestion to unknown prefix error.
1 parent 8dee9bc commit c856e6f

File tree

1 file changed

+4
-5
lines changed
  • compiler/rustc_parse/src/lexer

1 file changed

+4
-5
lines changed

compiler/rustc_parse/src/lexer/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,11 @@ impl<'a> StringReader<'a> {
509509
&format!("prefix `{}` is unknown", self.str_from_to(start, self.pos)),
510510
);
511511
err.span_label(self.mk_sp(start, self.pos), "unknown prefix");
512-
err.span_label(
512+
err.span_suggestion_verbose(
513513
self.mk_sp(self.pos, self.pos),
514-
&format!(
515-
"help: consider inserting a whitespace before this `{}`",
516-
self.str_from_to(self.pos, self.pos + BytePos(1)),
517-
),
514+
"consider inserting whitespace here",
515+
" ".into(),
516+
Applicability::MachineApplicable,
518517
);
519518
err.note("prefixed identifiers and string literals are reserved since Rust 2021");
520519

0 commit comments

Comments
 (0)