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

Mark Ident::new_raw as no longer semver-exempt #331

Merged
merged 2 commits into from
Jun 20, 2022

Conversation

mystor
Copy link
Contributor

@mystor mystor commented Jun 19, 2022

The previous Compiler behaviour appears to have been broken, in that it
would return a non-raw string literal, so it was replaced with the
fallback code from quote.

This will be needed to fix dtolnay/quote#223

The previous Compiler behaviour appears to have been broken, in that it
would return a non-raw string literal, so it was replaced with the
fallback code from quote [1].

[1]: https://github.com/dtolnay/quote/blob/eeabf0d42ed68418741542ab5cfa8a9d339f8a79/src/runtime.rs#L409-L422
@mystor
Copy link
Contributor Author

mystor commented Jun 20, 2022

I found another issue in that the fallback implementation doesn't appear to be performing raw identifier validation correctly. I've added some logic modeled after https://github.com/rust-lang/rust/blob/bb8c2f41174caceec00c28bc6c5c20ae9f9a175c/compiler/rustc_span/src/symbol.rs#L1973-L1991 to account for that, and some basic tests for it.

mystor added a commit to mystor/quote that referenced this pull request Jun 20, 2022
This requires the changes in
dtolnay/proc-macro2#331 which expose
Ident::new_raw from proc-macro2, along with providing a fallback for
earlier versions of Rust.

Fixes dtolnay#223
Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Thanks!

@dtolnay dtolnay merged commit 32a0b27 into dtolnay:master Jun 20, 2022
dtolnay pushed a commit to mystor/quote that referenced this pull request Jun 20, 2022
This requires the changes in
dtolnay/proc-macro2#331 which expose
Ident::new_raw from proc-macro2, along with providing a fallback for
earlier versions of Rust.

Fixes dtolnay#223
@dtolnay dtolnay mentioned this pull request Nov 26, 2023
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.

Use Ident::new_raw when it's available
2 participants