Skip to content

Commit 4450951

Browse files
committed
Maybe fix ICE?
1 parent 2ce631e commit 4450951

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clippy_lints/src/missing_const_for_fn.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingConstForFn {
8080
) {
8181
let def_id = cx.tcx.hir().local_def_id(node_id);
8282
let mir = cx.tcx.optimized_mir(def_id);
83-
if let Ok(_) = is_min_const_fn(cx.tcx, def_id, &mir) {
83+
if let Err((span, err) = is_min_const_fn(cx.tcx, def_id, &mir) {
84+
cx.tcx.sess.span_err(span, &err);
85+
} else {
8486
match kind {
8587
FnKind::ItemFn(name, _generics, header, _vis, attrs) => {
8688
if !can_be_const_fn(&name.as_str(), header, attrs) {

0 commit comments

Comments
 (0)