Skip to content

Commit 12ede17

Browse files
committed
used better condition for checking intrinsics
1 parent d15cdbf commit 12ede17

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

compiler/rustc_passes/src/liveness.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,18 +1521,12 @@ impl<'tcx> Liveness<'_, 'tcx> {
15211521
}
15221522

15231523
fn warn_about_unused_args(&self, body: &hir::Body<'_>, entry_ln: LiveNode) {
1524-
let is_intrinsic_with_no_body = self.ir.tcx.intrinsic(body.value.hir_id.owner.def_id)?.must_be_overridden();
1525-
1526-
if is_intrinsic {
1527-
let has_body = match &body.value.kind {
1528-
rustc_hir::ExprKind::Block(block, _) => !block.stmts.is_empty() || block.expr.is_some(),
1529-
_ => false,
1530-
};
1531-
if has_body {
1524+
if let Some(intrinsic) = self.ir.tcx.intrinsic(body.value.hir_id.owner.def_id) {
1525+
if intrinsic.must_be_overridden {
15321526
return;
15331527
}
15341528
}
1535-
1529+
15361530
for p in body.params {
15371531
self.check_unused_vars_in_pat(
15381532
p.pat,

0 commit comments

Comments
 (0)