-
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
Recover on const impl<> X for Y
#79668
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
I switched to using |
b375743
to
fddb520
Compare
ItemKind::Impl { .. } => return Err(err), | ||
_ => unreachable!(), | ||
} | ||
impl_info |
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.
Could you move this code to a separate function in parser/diagnostics.rs
?
That's where diagnostic or recovery code lives, so it's separated from the "reference parser" code describing the language.
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.
Oh I only just realized that you asked to move it to diagnostics.rs
; I just moved it under recover_const_mut
which is still in parser/item.rs
, there's other recover_*
functions there as well.
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.
parser/item.rs
, there's otherrecover_*
functions there as well.
(The other function will also need to move to diagnostics.rs
, but not in this PR.)
Could you also squash commits into one after making all the changes? |
c7dd5ff
to
ede6bd5
Compare
ede6bd5
to
1e27b65
Compare
Alrighty, squashed. |
Thanks! |
📌 Commit 1e27b65 has been approved by |
⌛ Testing commit 1e27b65 with merge a428dd84d4e3cb80da7a395a0a047b1adf52677d... |
💔 Test failed - checks-actions |
Looks spurious. |
☀️ Test successful - checks-actions |
@leonardo-m mentioned that
const impl Foo for Bar
could be recovered from in #79287.I'm not sure about the error strings as they are, I think it should probably be something like the error that
expected_one_of_not_found
makes + the suggestion to flip the keywords, but I'm not sure how exactly to do that. Also, I decided not to try to handleconst unsafe impl
orunsafe const impl
cause I figured thatunsafe impl const
would be pretty rare anyway (if it's even valid?), and it wouldn't be worth making the code more messy.