-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Replace (Body, DefId)
with Body
where possible
#77552
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
r? @lcnr (if you have the time) |
@@ -758,7 +758,7 @@ impl<'tcx> Validator<'_, 'tcx> { | |||
ty::FnDef(def_id, _) => { | |||
is_const_fn(self.tcx, def_id) | |||
|| is_unstable_const_fn(self.tcx, def_id).is_some() | |||
|| is_lang_panic_fn(self.tcx, self.def_id.to_def_id()) | |||
|| is_lang_panic_fn(self.tcx, def_id) |
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.
This line was incorrect. It should be checking the callee, not the caller. Really, it should just be removed entirely, since panicking in a const-context is still unstable and there's no need to promote diverging function calls.
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.
👍
A `Body` now contains its `MirSource`, which in turn contains the `DefId` of the item associated with the `Body`.
bd374d5
to
52484c5
Compare
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.
fn do_mir_borrowck
still takes a def
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.
That's a rather big improvement imo 👍
@@ -758,7 +758,7 @@ impl<'tcx> Validator<'_, 'tcx> { | |||
ty::FnDef(def_id, _) => { | |||
is_const_fn(self.tcx, def_id) | |||
|| is_unstable_const_fn(self.tcx, def_id).is_some() | |||
|| is_lang_panic_fn(self.tcx, self.def_id.to_def_id()) | |||
|| is_lang_panic_fn(self.tcx, def_id) |
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.
👍
Thanks, might be prone to merge conflicts @bors r+ rollup=iffy |
📌 Commit 04a94ab has been approved by |
☀️ Test successful - checks-actions, checks-azure |
Follow-up to #77430.
I
grep
-ed for parameter lists in which aBody
appeared within a few lines of aDefId
, so it's possible that I missed some cases, but this should be pretty complete. Most of these changes were mechanical, but there's a few places where I started calling things "caller" and "callee" when multipleDefId
s were in-scope at once. Also, we should probably have a helper function onBody
that returns aLocalDefId
. I can do that in this PR or in a follow-up.