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

Preserve leading underscores in generated Idents #225

Closed
eggyal opened this issue Jun 16, 2022 · 0 comments · Fixed by #321
Closed

Preserve leading underscores in generated Idents #225

eggyal opened this issue Jun 16, 2022 · 0 comments · Fixed by #321

Comments

@eggyal
Copy link

eggyal commented Jun 16, 2022

heck documents, under Definition of a word boundary:

Characters not within words (such as spaces, punctuations, and underscores) are not included in the output string except as they are a part of the case being converted to. Multiple adjacent word boundaries (such as a series of underscores) are folded into one. (“hello__world” in snake case is therefore “hello_world”, not the exact same string). Leading or trailing word boundary indicators are dropped, except insofar as CamelCase capitalizes the first word.

As a consequence, where heck is used to construct a Rust Ident that might only be valid due to its leading underscore (such as here), the resulting Ident may be invalid. See rust-lang/rust#98158 for a report of an arising ICE.

strum should ensure that, in such cases, leading underscores are preserved (or else document that such identifiers are unsupported).

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 a pull request may close this issue.

1 participant