@@ -528,14 +528,14 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
528
528
source_info : SourceInfo ,
529
529
message : & ' static str ,
530
530
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
+ }
539
539
}
540
540
541
541
fn check_unary_op (
@@ -557,7 +557,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
557
557
source_info,
558
558
"this arithmetic operation will overflow" ,
559
559
AssertKind :: OverflowNeg ( val. to_const_int ( ) ) ,
560
- ) ?;
560
+ ) ;
561
+ return None ;
561
562
}
562
563
563
564
Some ( ( ) )
@@ -602,7 +603,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
602
603
} ,
603
604
r. to_const_int ( ) ,
604
605
) ,
605
- ) ?;
606
+ ) ;
607
+ return None ;
606
608
}
607
609
}
608
610
@@ -617,7 +619,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
617
619
source_info,
618
620
"this arithmetic operation will overflow" ,
619
621
AssertKind :: Overflow ( op, l. to_const_int ( ) , r. to_const_int ( ) ) ,
620
- ) ?;
622
+ ) ;
623
+ return None ;
621
624
}
622
625
}
623
626
Some ( ( ) )
0 commit comments