Conversation
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
| let hir = cx.tcx.hir(); | ||
| if_chain! { | ||
| if let Some(Node::Pat(pat)) = hir.find(hir_id); | ||
| if let Node::Pat(pat) = hir.get(hir_id); |
There was a problem hiding this comment.
Looking through the Clippy changes, it seems that get asserts that this node exists. I'm not 100% sure that this will just work in all cases in Clippy.
So if your assertion that all nodes exist by construction is true this should be fine. Otherwise I can see many new ICE issues in the future. I'm not informed enough to help with a decision regarding this, though.
|
Currently, not all HirId have an associated node. So this PR introduces a strong risk of ICEs. Before this PR, we should remove those holes:
Waiting for the removal of save-analysis will create more opportunities for (1). In the future, we may use the creation of |
|
☔ The latest upstream changes (presumably #106432) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@rustbot author |
I'm not exactly sure what value this function gives us. I though that by construction all HIR ids are present in the HIR map, and I can't seem to find a case where
Map::findwould ever returnNone.Before attempting this PR, I actually tried replacing the body of
hir::Map::findwith one that unwraps, and nothing seemed to change. Perhaps I'm overlooking something really critical, though?r? @cjgillot but feel free to reassign.