-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Suggest adding mut
or const
after &raw
#135751
base: master
Are you sure you want to change the base?
Conversation
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
The job Click to see the possible cause of the failure (guessed by this bot)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fear that this approach is both not general enough, and generalizing it further would require sprinkling around suggest_add_mut_or_const_in_raw_ref
into too many places in the parser.
We basically have to add a recovery to every path where we could have &raw X
, right? For example, this doesn't currently work in function argument position, or the LHS of an assignment (not a let
), or in a struct constructor.
I see, I was pretty much just just copying |
On parse errors where we just parsed
&raw
we can suggest using a raw reference addingmut
orconst
after, though raw is contextual so it might not always be accurate.Example:
Closes #133231