@@ -428,6 +428,7 @@ pub fn lit_to_mir_constant(lit: &LitKind, ty: Option<Ty<'_>>) -> Constant {
428428 FloatTy :: F32 => Constant :: F32 ( is. as_str ( ) . parse ( ) . unwrap ( ) ) ,
429429 FloatTy :: F64 => Constant :: F64 ( is. as_str ( ) . parse ( ) . unwrap ( ) ) ,
430430 FloatTy :: F128 => Constant :: parse_f128 ( is. as_str ( ) ) ,
431+ FloatTy :: PpcF128 => bug ! ( "no ppcf128 literals" ) ,
431432 } ,
432433 LitKind :: Float ( ref is, LitFloatType :: Unsuffixed ) => match ty. expect ( "type of float is known" ) . kind ( ) {
433434 ty:: Float ( FloatTy :: F16 ) => Constant :: parse_f16 ( is. as_str ( ) ) ,
@@ -991,8 +992,9 @@ impl<'tcx> ConstEvalCtxt<'tcx> {
991992 let l = sext ( self . tcx , l, ity) ;
992993 let r = sext ( self . tcx , r, ity) ;
993994
994- // Using / or %, where the left-hand argument is the smallest integer of a signed integer type and
995- // the right-hand argument is -1 always panics, even with overflow-checks disabled
995+ // Using / or %, where the left-hand argument is the smallest integer of a
996+ // signed integer type and the right-hand argument is -1
997+ // always panics, even with overflow-checks disabled
996998 if let BinOpKind :: Div | BinOpKind :: Rem = op
997999 && l == ty_min_value
9981000 && r == -1
@@ -1106,10 +1108,14 @@ pub fn mir_to_const<'tcx>(tcx: TyCtxt<'tcx>, val: ConstValue, ty: Ty<'tcx>) -> O
11061108 ( ConstValue :: Scalar ( Scalar :: Int ( int) ) , _) => match ty. kind ( ) {
11071109 ty:: Bool => Some ( Constant :: Bool ( int == ScalarInt :: TRUE ) ) ,
11081110 ty:: Uint ( _) | ty:: Int ( _) => Some ( Constant :: Int ( int. to_bits ( int. size ( ) ) ) ) ,
1109- ty:: Float ( FloatTy :: F16 ) => Some ( Constant :: F16 ( int. into ( ) ) ) ,
1110- ty:: Float ( FloatTy :: F32 ) => Some ( Constant :: F32 ( f32:: from_bits ( int. into ( ) ) ) ) ,
1111- ty:: Float ( FloatTy :: F64 ) => Some ( Constant :: F64 ( f64:: from_bits ( int. into ( ) ) ) ) ,
1112- ty:: Float ( FloatTy :: F128 ) => Some ( Constant :: F128 ( int. into ( ) ) ) ,
1111+
1112+ ty:: Float ( float) => match float {
1113+ FloatTy :: F16 => Some ( Constant :: F16 ( int. into ( ) ) ) ,
1114+ FloatTy :: F32 => Some ( Constant :: F32 ( f32:: from_bits ( int. into ( ) ) ) ) ,
1115+ FloatTy :: F64 => Some ( Constant :: F64 ( f64:: from_bits ( int. into ( ) ) ) ) ,
1116+ FloatTy :: F128 => Some ( Constant :: F128 ( int. into ( ) ) ) ,
1117+ FloatTy :: PpcF128 => None ,
1118+ } ,
11131119 ty:: RawPtr ( _, _) => Some ( Constant :: RawPtr ( int. to_bits ( int. size ( ) ) ) ) ,
11141120 _ => None ,
11151121 } ,
@@ -1133,6 +1139,7 @@ pub fn mir_to_const<'tcx>(tcx: TyCtxt<'tcx>, val: ConstValue, ty: Ty<'tcx>) -> O
11331139 FloatTy :: F32 => Constant :: F32 ( f32:: from_bits ( val. to_u32 ( ) . discard_err ( ) ?) ) ,
11341140 FloatTy :: F64 => Constant :: F64 ( f64:: from_bits ( val. to_u64 ( ) . discard_err ( ) ?) ) ,
11351141 FloatTy :: F128 => Constant :: F128 ( val. to_u128 ( ) . discard_err ( ) ?) ,
1142+ FloatTy :: PpcF128 => return None ,
11361143 } ) ;
11371144 }
11381145 Some ( Constant :: Vec ( res) )
0 commit comments