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

Stricter parsing of string_continue escapes in cooked string #392

Merged
merged 3 commits into from
Jun 24, 2023

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Jun 24, 2023

This PR ports dtolnay/syn#1381 from syn's literal parser to proc-macro2's literal lexer.

Before this PR, "b\"\\\n\u{a0}\"" would parse successfully as a byte string literal token. The trailing backslash would skip over all following Unicode whitespace, including the non-breaking space codepoint. This behavior was incorrect. Trailing backslash is only supposed to skip over ASCII space, \t, \n, and \r\n. Non-ASCII codepoints such as nbsp are not allowed in the representation of a byte string literal.

@dtolnay dtolnay merged commit 45f0dde into master Jun 24, 2023
18 checks passed
@dtolnay dtolnay deleted the whitespace branch June 24, 2023 18:29
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.

None yet

1 participant