diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-06-17 05:54:58 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-17 05:54:58 +0900 |
| commit | 36bf808aa1a4633ac0d69c9d06063e0760c8a5a2 (patch) | |
| tree | 72b334bf89132ca057b05c6b04a703cd2064403d | |
| parent | 4e9dc76d36b58601b56e629affe56972e3a63ecb (diff) | |
| parent | e42d5eed314463c751836e452769991b5d71e30b (diff) | |
| download | rust-36bf808aa1a4633ac0d69c9d06063e0760c8a5a2.tar.gz rust-36bf808aa1a4633ac0d69c9d06063e0760c8a5a2.zip | |
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
| -rw-r--r-- | compiler/rustc_mir/src/transform/const_prop.rs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/compiler/rustc_mir/src/transform/const_prop.rs b/compiler/rustc_mir/src/transform/const_prop.rs index 681d63c6fc9..73a0f5537c3 100644 --- a/compiler/rustc_mir/src/transform/const_prop.rs +++ b/compiler/rustc_mir/src/transform/const_prop.rs @@ -528,14 +528,14 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { source_info: SourceInfo, message: &'static str, panic: AssertKind<impl std::fmt::Debug>, - ) -> Option<()> { - let lint_root = self.lint_root(source_info)?; - self.tcx.struct_span_lint_hir(lint, lint_root, source_info.span, |lint| { - let mut err = lint.build(message); - err.span_label(source_info.span, format!("{:?}", panic)); - err.emit() - }); - None + ) { + if let Some(lint_root) = self.lint_root(source_info) { + self.tcx.struct_span_lint_hir(lint, lint_root, source_info.span, |lint| { + let mut err = lint.build(message); + err.span_label(source_info.span, format!("{:?}", panic)); + err.emit() + }); + } } fn check_unary_op( @@ -557,7 +557,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { source_info, "this arithmetic operation will overflow", AssertKind::OverflowNeg(val.to_const_int()), - )?; + ); + return None; } Some(()) @@ -602,7 +603,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { }, r.to_const_int(), ), - )?; + ); + return None; } } @@ -617,7 +619,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { source_info, "this arithmetic operation will overflow", AssertKind::Overflow(op, l.to_const_int(), r.to_const_int()), - )?; + ); + return None; } } Some(()) |
