Skip to content

Commit 6c5a721

Browse files
committed
Don't try to evaluate const FnDefs in KnownPanicsLint
1 parent 507666c commit 6c5a721

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_mir_transform/src/known_panics_lint.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
255255
return None;
256256
}
257257

258+
// Don't try to evaluate the Operand::Const of calls to a concrete fn
259+
if matches!(c.ty().kind(), ty::FnDef(..)) {
260+
return None;
261+
}
262+
258263
// Normalization needed b/c known panics lint runs in
259264
// `mir_drops_elaborated_and_const_checked`, which happens before
260265
// optimized MIR. Only after optimizing the MIR can we guarantee

0 commit comments

Comments
 (0)