-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raw string error note #48546
Raw string error note #48546
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
2135a57
to
b4ee47d
Compare
src/test/ui/raw_string.rs
Outdated
fn main() { | ||
let x = r##"lol"#; | ||
//~^ ERROR unterminated raw string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: should be newline-terminated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Fixed.
b4ee47d
to
74f1489
Compare
src/test/ui/raw_string.stderr
Outdated
14 | | } | ||
| |__^ | ||
| | ||
= note: this raw string should be terminated with `"##` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The span should really only point at the first char and have a span label:
error: unterminated raw string
--> $DIR/raw_string.rs:12:13
|
12 | let x = r##"lol"#;
| ^ unterminated raw string
|
= note: this raw string must be terminated with `"##`
Other than the nitpick, r=me |
r? @estebank |
74f1489
to
1c191b2
Compare
Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, r=me after addressing the nit-pick.
@@ -269,6 +281,15 @@ impl<'a> StringReader<'a> { | |||
Self::push_escaped_char_for_msg(&mut m, c); | |||
self.fatal_span_(from_pos, to_pos, &m[..]) | |||
} | |||
|
|||
fn struct_span_fatal(&self, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this method necessary after the last change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it being used only in fail_unterminated_raw_string
above? The span for the error and the span_label could be made only once (self.mk_span(pos, pos)
) and the message and label literal could be the same variable.
@bors r+ rollup |
📌 Commit 1c191b2 has been approved by |
…e, r=estebank Raw string error note Fixes rust-lang#48395. I think this note should be helpful enough to solve the issue.
…e, r=estebank Raw string error note Fixes rust-lang#48395. I think this note should be helpful enough to solve the issue.
…e, r=estebank Raw string error note Fixes rust-lang#48395. I think this note should be helpful enough to solve the issue.
Fixes #48395.
I think this note should be helpful enough to solve the issue.