You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with rustc rustc 1.65.0-nightly (c07a8b4e0 2022-08-26) this runs in a couple ms: rustc ./a.rs --crate-type=lib -Zsave-analysis -Ztime=yes -Ztime-passes=yes
with rustc rustc 1.65.0-nightly (3c7278846 2022-09-06) this seems to hang somewhere in save-analysis
Node::PathSegment(seg) => match seg.res {
Some(res) if res != Res::Err => res,
_ => {
let parent_node = self.tcx.hir().get_parent_node(hir_id);
self.get_path_res(parent_node)
}
},
The new code looks like this:
Node::PathSegment(seg) => {
if seg.res != Res::Err {
seg.res
} else {
let parent_node = self.tcx.hir().get_parent_node(hir_id);
self.get_path_res(parent_node)
}
}
because seg.res is no longer optional.
The infinite recursion happens because the get_parent_node call returns a parent_node that is the same as the hir_id. When I printed that ID out it looks like this:
Activity
matthiaskrgr commentedon Sep 6, 2022
reduced:
RIP
-Zsave-analysismatthiaskrgr commentedon Sep 6, 2022
I think this is caused by #101228 cc @nnethercote
nnethercote commentedon Sep 7, 2022
Clearly a well tested feature 😛 I'll take a look.
nnethercote commentedon Sep 7, 2022
The old code looked like this:
The new code looks like this:
because
seg.resis no longer optional.The infinite recursion happens because the
get_parent_nodecall returns aparent_nodethat is the same as thehir_id. When I printed that ID out it looks like this:An easy fix is to check if
parent_nodeis the same ashir_idand returnRes:Errif so. But I don't know if that's just papering over a deeper problem.@petrochenkov: Is it an underlying bug that
get_parent_nodecan return the same node it is given?Auto merge of rust-lang#101688 - cjgillot:verify-hir-parent, r=petroc…