Skip to content

Show better error message for incorrect unicode escape sequences syntax #26782

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

Closed
wants to merge 1 commit into from

Conversation

bombless
Copy link
Contributor

@bombless bombless commented Jul 5, 2015

This patch gives better error message if the braces are missing when you use unicode escape sequences in string literals.

@rust-highfive
Copy link
Contributor

r? @nikomatsakis

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

@bombless bombless force-pushed the unicode-escape-sequences branch 3 times, most recently from 95f4270 to cdc96ac Compare July 5, 2015 01:44
@bombless
Copy link
Contributor Author

bombless commented Jul 5, 2015

Thank @niconii for the help here 😄

@bombless bombless force-pushed the unicode-escape-sequences branch from cdc96ac to 3d6afbe Compare July 5, 2015 02:11
escaped_pos,
self.last_pos,
"`\\u` in string literals start unicode escape sequences; \
for example, use `\\u{30a2}` to specify codepoint U+30A2, \
Copy link
Member

Choose a reason for hiding this comment

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

Should be a separate help diagnostic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll make it separate help message if that's needed

@bombless
Copy link
Contributor Author

bombless commented Jul 8, 2015

r? @pnkfelix

@bombless bombless closed this Jul 10, 2015
bors added a commit that referenced this pull request Jul 13, 2015
Inspired by the now-mysteriously-closed #26782.

This PR introduces better error messages when unicode escapes have invalid format (e.g. `\uFFFF`). It also makes rustc always tell the user that escape may not be used in byte-strings and bytes and fixes some spans to not include unecessary characters and include escape backslash in some others.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants