@@ -575,10 +575,8 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
575575
576576 Rvalue :: UnaryOp ( _, operand) => {
577577 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.
582580 } else {
583581 span_bug ! ( self . span, "non-primitive type in `Rvalue::UnaryOp`: {:?}" , ty) ;
584582 }
@@ -588,8 +586,8 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
588586 let lhs_ty = lhs. ty ( self . body , self . tcx ) ;
589587 let rhs_ty = rhs. ty ( self . body , self . tcx ) ;
590588
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.
593591 } else if lhs_ty. is_fn_ptr ( ) || lhs_ty. is_unsafe_ptr ( ) {
594592 assert_matches ! (
595593 op,
@@ -603,8 +601,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
603601 ) ;
604602
605603 self . check_op ( ops:: RawPtrComparison ) ;
606- } else if lhs_ty. is_floating_point ( ) || rhs_ty. is_floating_point ( ) {
607- self . check_op ( ops:: FloatingPointOp ) ;
608604 } else {
609605 span_bug ! (
610606 self . span,
@@ -1009,8 +1005,8 @@ fn place_as_reborrow<'tcx>(
10091005 }
10101006}
10111007
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 ( )
10141010}
10151011
10161012fn emit_unstable_in_stable_error ( ccx : & ConstCx < ' _ , ' _ > , span : Span , gate : Symbol ) {
0 commit comments