about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbeetrees <b@beetr.ee>2024-05-06 13:27:40 +0100
committerbeetrees <b@beetr.ee>2024-05-06 14:56:10 +0100
commitf26221a936de0f4156b4ec9489ec7d9af78392ad (patch)
tree781a778ea16d3de696a34ca0116157468843bc5e
parentefa15ebfef7d1ee26bb54b3737653227870c68c1 (diff)
downloadrust-f26221a936de0f4156b4ec9489ec7d9af78392ad.tar.gz
rust-f26221a936de0f4156b4ec9489ec7d9af78392ad.zip
Refactor float `Primitive`s to a separate `Float` type
-rw-r--r--src/type_of.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/type_of.rs b/src/type_of.rs
index 8f9bfbbd18f..90e139494b8 100644
--- a/src/type_of.rs
+++ b/src/type_of.rs
@@ -8,8 +8,8 @@ use rustc_middle::ty::print::with_no_trimmed_paths;
 use rustc_middle::ty::{self, Ty, TypeVisitableExt};
 use rustc_target::abi::call::{CastTarget, FnAbi, Reg};
 use rustc_target::abi::{
-    self, Abi, Align, FieldsShape, Int, Integer, PointeeInfo, Pointer, Size, TyAbiInterface,
-    Variants, F128, F16, F32, F64,
+    self, Abi, Align, FieldsShape, Float, Int, Integer, PointeeInfo, Pointer, Size, TyAbiInterface,
+    Variants,
 };
 
 use crate::abi::{FnAbiGcc, FnAbiGccExt, GccType};
@@ -283,10 +283,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
         match scalar.primitive() {
             Int(i, true) => cx.type_from_integer(i),
             Int(i, false) => cx.type_from_unsigned_integer(i),
-            F16 => cx.type_f16(),
-            F32 => cx.type_f32(),
-            F64 => cx.type_f64(),
-            F128 => cx.type_f128(),
+            Float(f) => cx.type_from_float(f),
             Pointer(address_space) => {
                 // If we know the alignment, pick something better than i8.
                 let pointee = if let Some(pointee) = self.pointee_info_at(cx, offset) {