mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-29 03:37:26 +03:00
document why it is important to early return on ExpectedStringLiteral
This commit is contained in:
@@ -687,13 +687,15 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
|
||||
AttributeParseErrorReason::ExpectedStringLiteral { byte_string } => {
|
||||
if let Some(start_point_span) = byte_string {
|
||||
diag.span_suggestion(
|
||||
start_point_span,
|
||||
*start_point_span,
|
||||
"consider removing the prefix",
|
||||
"",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
diag.note("expected a normal string literal, not a byte string literal");
|
||||
|
||||
// Avoid emitting an "attribute must be of the form" suggestion, as the
|
||||
// attribute is likely to be well-formed already.
|
||||
return diag;
|
||||
} else {
|
||||
diag.span_label(self.span, "expected a string literal here");
|
||||
|
||||
Reference in New Issue
Block a user