-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make functions passed to BoundVarReplacer be optional #83090
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
Conversation
r? @varkor (rust-highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit d22289d3ce6cbdb1ba66053d03ef23e96985fc50 with merge 4f15e3f1454acbf63f87a260b0b68a36cb27206a... |
☀️ Try build successful - checks-actions |
Queued 4f15e3f1454acbf63f87a260b0b68a36cb27206a with parent 56f74c5, future comparison URL. |
Finished benchmarking try commit (4f15e3f1454acbf63f87a260b0b68a36cb27206a): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
Perf is mixed. Maybe slightly clean on instruction counts, but heavily mixed for max-rss and wall-time. I'll leave it up to a reviewer to decide if benefits of " |
@@ -471,9 +471,12 @@ impl<'a, 'tcx> TypeFolder<'tcx> for BoundVarReplacer<'a, 'tcx> { | |||
match *t.kind() { |
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 wonder whether something like this would be more readable:
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
match *t.kind() {
ty::Bound(debruijn, bound_ty) if debruijn == self.current_index => {
if let Some(fld_t) = self.fld_t.as_mut() {
let ty = fld_t(bound_ty);
return ty::fold::shift_vars(self.tcx, &ty, self.current_index.as_u32());
}
}
_ if t.has_vars_bound_at_or_above(self.current_index) => return t.super_fold_with(self),
}
t
}
(and similarly for the other methods).
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.
Ooh, I like that
I don't have a strong opinion on whether this is more or less readable. If you personally find it more readable, then I'm happy. It would be nice to simplify the methods as in my comment above, though. |
I personally think the idea of " |
d22289d
to
ba27cae
Compare
r=me when CI passes. |
@bors r=varkor |
📌 Commit ba27cae has been approved by |
⌛ Testing commit ba27cae with merge 3b8e3d885585effc745b57c774aabf56bff6c4a9... |
💔 Test failed - checks-actions |
Looks spurious @bors retry |
☀️ Test successful - checks-actions |
This means we can reuse the bound vars when we don't care to change them