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

Parse ~const modifier #1051

Closed
dtolnay opened this issue Sep 2, 2021 · 2 comments · Fixed by #1083
Closed

Parse ~const modifier #1051

dtolnay opened this issue Sep 2, 2021 · 2 comments · Fixed by #1083
Labels

Comments

@dtolnay
Copy link
Owner

dtolnay commented Sep 2, 2021

@yaahc
Copy link

yaahc commented Oct 5, 2021

Hey, I'm interested in fixing this issue so that cargo unstable-api can start working again. I looked into it a bit and it seems like the right place to make the change would be to update TraitBoundModifier to add a MaybeConst variant or something, but this enum is pub and exhaustive, so I'm assuming this change can't be made under syn's stability guarantees.

Do you have an idea for how you are planning to add support for the const modifier? I'd be happy to implement it but I'm unsure of how to proceed so I figured I'd ask first.

@dtolnay
Copy link
Owner Author

dtolnay commented Oct 6, 2021

You can stick it anywhere in the existing syntax tree. The syntax tree itself doesn't change until after the syntax gets stabilized.

For example any of the following would work:

  • Parse the whole surrounding impl-block as Item::Verbatim instead of Item::Impl
  • Convert the surrounding PredicateType's bounded_ty to a Type::Verbatim and prefix the ~const tokens onto it
  • Insert ~const as a segment in the TraitBound's path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants