Skip to content

Commit 36bf808

Browse files
authored
Rollup merge of #86341 - LingMan:ret_val, r=davidtwco
Stop returning a value from `report_assert_as_lint` This function only ever returns `None`. Make that explicity by not returning a value at all. `@rustbot` modify labels +C-cleanup +T-compiler
2 parents 4e9dc76 + e42d5ee commit 36bf808

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

compiler/rustc_mir/src/transform/const_prop.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -528,14 +528,14 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
528528
source_info: SourceInfo,
529529
message: &'static str,
530530
panic: AssertKind<impl std::fmt::Debug>,
531-
) -> Option<()> {
532-
let lint_root = self.lint_root(source_info)?;
533-
self.tcx.struct_span_lint_hir(lint, lint_root, source_info.span, |lint| {
534-
let mut err = lint.build(message);
535-
err.span_label(source_info.span, format!("{:?}", panic));
536-
err.emit()
537-
});
538-
None
531+
) {
532+
if let Some(lint_root) = self.lint_root(source_info) {
533+
self.tcx.struct_span_lint_hir(lint, lint_root, source_info.span, |lint| {
534+
let mut err = lint.build(message);
535+
err.span_label(source_info.span, format!("{:?}", panic));
536+
err.emit()
537+
});
538+
}
539539
}
540540

541541
fn check_unary_op(
@@ -557,7 +557,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
557557
source_info,
558558
"this arithmetic operation will overflow",
559559
AssertKind::OverflowNeg(val.to_const_int()),
560-
)?;
560+
);
561+
return None;
561562
}
562563

563564
Some(())
@@ -602,7 +603,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
602603
},
603604
r.to_const_int(),
604605
),
605-
)?;
606+
);
607+
return None;
606608
}
607609
}
608610

@@ -617,7 +619,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
617619
source_info,
618620
"this arithmetic operation will overflow",
619621
AssertKind::Overflow(op, l.to_const_int(), r.to_const_int()),
620-
)?;
622+
);
623+
return None;
621624
}
622625
}
623626
Some(())

0 commit comments

Comments
 (0)