Skip to content

fix: Fix invalid signature bitflags #19563

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

Merged
merged 1 commit into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/hir-def/src/expr_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions crates/hir-ty/src/diagnostics/unsafe_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ impl<'a> UnsafeVisitor<'a> {
Expr::Closure { args, .. } => {
self.walk_pats_top(args.iter().copied(), current);
}
Expr::Const(e) => self.walk_expr(*e),
_ => {}
}

Expand Down
13 changes: 13 additions & 0 deletions crates/ide-diagnostics/src/handlers/missing_unsafe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,19 @@ fn baz() {
fn f(it: unsafe fn()){
it();
// ^^^^ 💡 error: call to unsafe function is unsafe and requires an unsafe function or block
}
"#,
);
}

#[test]
fn unsafe_call_in_const_expr() {
check_diagnostics(
r#"
unsafe fn f() {}
fn main() {
const { f(); };
// ^^^ 💡 error: call to unsafe function is unsafe and requires an unsafe function or block
}
"#,
);
Expand Down