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

Prefix idents that don't start with an alphabetic character #466

Closed
wants to merge 3 commits into from

Conversation

LegNeato
Copy link

No description provided.

@LucioFranco
Copy link
Member

Hi @LegNeato do you know of any precedent on how other protobuf implementations handle this?

@LegNeato
Copy link
Author

I do not, I can look into it though. I think if the find & replace infra was a bit more robust this wouldn't be necessary. I'll look into a larger patch as well as what other impls do

@LegNeato
Copy link
Author

LegNeato commented Aug 3, 2021

Ok, I looked into how protoc handles this. It is a mess! Every language does different things and there is a bunch of undocumented behavior.

This is a problem because prost strips enum prefixes, which turns a valid identifier field name to an invalid identifier. But, similar issues can arise with rust restricted keywords (there are a ton of protoc issues where people have valid idents in one language that are reserved in another, chaos ensues).

prost-build/src/ident.rs Outdated Show resolved Hide resolved
prost-build/src/ident.rs Outdated Show resolved Hide resolved
@danburkert
Copy link
Collaborator

Please also add a test to fn test_ident_conversions/ident_conversion.proto's StrawberryRhubarbPIE

@LegNeato
Copy link
Author

LegNeato commented Sep 9, 2021

I plan to get to this in the next couple of days, thanks @danburkert for the review!

@LegNeato
Copy link
Author

LegNeato commented Oct 1, 2021

@danburkert Sorry this took so long, thank you again for the review.

@LucioFranco LucioFranco added this to the v0.9.0 milestone Oct 6, 2021
@LucioFranco LucioFranco requested a review from danburkert October 6, 2021 20:24
@LucioFranco
Copy link
Member

@LegNeato seems need to fix the rustfmt ci stage

@LucioFranco LucioFranco removed this from the v0.9.0 milestone Oct 13, 2021
@LegNeato
Copy link
Author

LegNeato commented Dec 2, 2021

@LucioFranco whoops, done.

@caspermeijn
Copy link
Collaborator

This has recently been fixed by #998

@LegNeato LegNeato deleted the prefix branch April 12, 2024 17:37
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.

4 participants