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

Use &'static str in ParseError::UnrecognizedEOF and ParseError::UnrecognizedToken #700

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kmeakin
Copy link
Contributor

@Kmeakin Kmeakin commented Jan 17, 2023

Replace Vec<String> with Vec<&'static str> in ParseError::UnrecognizedEOF and ParseError::UnrecognizedToken. Since the terminal names are all known ahead of time, there is no need to store them on the heap.

@nikomatsakis
Copy link
Collaborator

Thanks for the PR. This is a reasonable change, but I'm also not sure how much I want to commit to knowing things up-front and not having dynamically generated names. Is there a strong motivation for this, or is it more like "general hygiene"?

@Kmeakin
Copy link
Contributor Author

Kmeakin commented Mar 16, 2023

Just general hygenie: I'm allergic to unnecessary allocations. If you want to keep the ability to have dynamically generated names, we could use Cow<'static, str>

@nikomatsakis nikomatsakis added this to the 1.0 milestone Mar 21, 2023
@nikomatsakis
Copy link
Collaborator

That makes sense, but then the types are more complicated, which also doesn't seem worth it to me yet.

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

2 participants