Repository navigation
gather body owners - #98203
gather body owners#98203
Conversation
|
r? @nagisa (rust-highfive has picked a reviewer for you, use r? to override) |
|
r? @cjgillot |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
What about this?
| if self.tcx.hir().is_body_owner(item.def_id) { | |
| if associated_body(Node::Item(item)).is_some() { |
0366bfc to
327a469
Compare
This comment has been minimized.
This comment has been minimized.
8343258 to
b535db3
Compare
This comment has been minimized.
This comment has been minimized.
b535db3 to
1160496
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
We want to record the LocalDefId of the closure. hir_id.owner is the one of the closure's surrounding item-like (that we have already recorded in visit_*item).
| self.body_owners.push(ex.hir_id.owner); | |
| self.body_owners.push(self.tcx.hir().local_def_id(ex.hir_id)); |
Likewise for anon consts.
There was a problem hiding this comment.
This probably pushes the same LocalDefId twice.
There was a problem hiding this comment.
Thanks, that was the problem.
bbc27a9 to
17734a6
Compare
There was a problem hiding this comment.
associated_body(...).is_some() is always true on closures.
There was a problem hiding this comment.
Could you inline the definition of associated_body here?
There was a problem hiding this comment.
Could you inline the definition of associated_body here?
There was a problem hiding this comment.
Could you inline the definition of associated_body here?
There was a problem hiding this comment.
I wonder if we can merge this visitor and the one for hir_module_items using some flag to switch behaviour.
There was a problem hiding this comment.
Sorry, I forgot to remove this.
There was a problem hiding this comment.
This case is possibly wrong.
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
4d38f6e to
75ffbb0
Compare
|
@bors retry |
|
⌛ Testing commit 75ffbb021cc96d6032fe5cad46153e401dc51802 with merge adc213b9b01134a4bcfc3efdac1e293946e6ab2d... |
|
💔 Test failed - checks-actions |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
| par_iter(self.tcx.hir_crate_items(()).body_owners.to_vec()).for_each(|def_id| f(def_id)); | |
| par_iter(&self.tcx.hir_crate_items(()).body_owners[..]).for_each(|&def_id| f(def_id)); |
?
There was a problem hiding this comment.
This will insert a module as its own submodule. We should probably handle all ItemKind::Mod in visit_item.
There was a problem hiding this comment.
I think the if-else in visit_item would prevent that from happening? visit_mod gets called only by walk_item.
if !self.crate_collector && let ItemKind::Mod(..) = item.kind {
// If this declares another module, do not recurse inside it.
self.submodules.push(item.def_id);
} else {
intravisit::walk_item(self, item)
}
There was a problem hiding this comment.
visit_mod is the entry point called by hir_module_items.
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
75ffbb0 to
ad76362
Compare
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
ad76362 to
2d265b6
Compare
|
@bors r+ |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (30243dd): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
Issue #96341