Skip to content
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

Merged

Conversation

GuillaumeGomez
Copy link
Member

Fixes #48395.

I think this note should be helpful enough to solve the issue.

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 26, 2018
fn main() {
let x = r##"lol"#;
//~^ ERROR unterminated raw string
}
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed.

@eddyb
Copy link
Member

eddyb commented Feb 26, 2018

r? @nikomatsakis

14 | | }
| |__^
|
= note: this raw string should be terminated with `"##`
Copy link
Contributor

@estebank estebank Feb 27, 2018

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 `"##`

@estebank
Copy link
Contributor

Other than the nitpick, r=me

@nikomatsakis
Copy link
Contributor

r? @estebank

@estebank estebank added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 2, 2018
@GuillaumeGomez
Copy link
Member Author

Updated.

Copy link
Contributor

@estebank estebank left a 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,
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still yes.

Copy link
Contributor

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.

@estebank
Copy link
Contributor

estebank commented Mar 5, 2018

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 5, 2018

📌 Commit 1c191b2 has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 5, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Mar 6, 2018
…e, r=estebank

Raw string error note

Fixes rust-lang#48395.

I think this note should be helpful enough to solve the issue.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Mar 6, 2018
…e, r=estebank

Raw string error note

Fixes rust-lang#48395.

I think this note should be helpful enough to solve the issue.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Mar 6, 2018
…e, r=estebank

Raw string error note

Fixes rust-lang#48395.

I think this note should be helpful enough to solve the issue.
bors added a commit that referenced this pull request Mar 6, 2018
Rollup of 14 pull requests

- Successful merges: #48403, #48432, #48546, #48573, #48590, #48657, #48727, #48732, #48753, #48754, #48761, #48474, #48507, #47463
- Failed merges:
@alexcrichton alexcrichton merged commit 1c191b2 into rust-lang:master Mar 6, 2018
@GuillaumeGomez GuillaumeGomez deleted the raw-string-error-note branch March 6, 2018 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants