fix: Walk const block expressions for unsafety checking

This commit is contained in:
Lukas Wirth 2025-04-10 15:56:31 +02:00
parent 4fdc2507c6
commit 8df812f14d
3 changed files with 21 additions and 0 deletions

View file

@ -282,6 +282,9 @@ impl ExpressionStore {
}
}
/// Walks the immediate children expressions and calls `f` for each child expression.
///
/// Note that this does not walk const blocks.
pub fn walk_child_exprs(&self, expr_id: ExprId, mut f: impl FnMut(ExprId)) {
let expr = &self[expr_id];
match expr {
@ -415,6 +418,10 @@ impl ExpressionStore {
}
}
/// Walks the immediate children expressions and calls `f` for each child expression but does
/// not walk expressions within patterns.
///
/// Note that this does not walk const blocks.
pub fn walk_child_exprs_without_pats(&self, expr_id: ExprId, mut f: impl FnMut(ExprId)) {
let expr = &self[expr_id];
match expr {