@@ -575,10 +575,8 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
575
575
576
576
Rvalue :: UnaryOp ( _, operand) => {
577
577
let ty = operand. ty ( self . body , self . tcx ) ;
578
- if is_int_bool_or_char ( ty) {
579
- // Int, bool, and char operations are fine.
580
- } else if ty. is_floating_point ( ) {
581
- self . check_op ( ops:: FloatingPointOp ) ;
578
+ if is_int_bool_float_or_char ( ty) {
579
+ // Int, bool, float, and char operations are fine.
582
580
} else {
583
581
span_bug ! ( self . span, "non-primitive type in `Rvalue::UnaryOp`: {:?}" , ty) ;
584
582
}
@@ -588,8 +586,8 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
588
586
let lhs_ty = lhs. ty ( self . body , self . tcx ) ;
589
587
let rhs_ty = rhs. ty ( self . body , self . tcx ) ;
590
588
591
- if is_int_bool_or_char ( lhs_ty) && is_int_bool_or_char ( rhs_ty) {
592
- // Int, bool, and char operations are fine.
589
+ if is_int_bool_float_or_char ( lhs_ty) && is_int_bool_float_or_char ( rhs_ty) {
590
+ // Int, bool, float, and char operations are fine.
593
591
} else if lhs_ty. is_fn_ptr ( ) || lhs_ty. is_unsafe_ptr ( ) {
594
592
assert_matches ! (
595
593
op,
@@ -603,8 +601,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
603
601
) ;
604
602
605
603
self . check_op ( ops:: RawPtrComparison ) ;
606
- } else if lhs_ty. is_floating_point ( ) || rhs_ty. is_floating_point ( ) {
607
- self . check_op ( ops:: FloatingPointOp ) ;
608
604
} else {
609
605
span_bug ! (
610
606
self . span,
@@ -1009,8 +1005,8 @@ fn place_as_reborrow<'tcx>(
1009
1005
}
1010
1006
}
1011
1007
1012
- fn is_int_bool_or_char ( ty : Ty < ' _ > ) -> bool {
1013
- ty. is_bool ( ) || ty. is_integral ( ) || ty. is_char ( )
1008
+ fn is_int_bool_float_or_char ( ty : Ty < ' _ > ) -> bool {
1009
+ ty. is_bool ( ) || ty. is_integral ( ) || ty. is_char ( ) || ty . is_floating_point ( )
1014
1010
}
1015
1011
1016
1012
fn emit_unstable_in_stable_error ( ccx : & ConstCx < ' _ , ' _ > , span : Span , gate : Symbol ) {
0 commit comments