From 3769fddba23985e9ab83828ccce672507e7dd891 Mon Sep 17 00:00:00 2001 From: beetrees Date: Mon, 6 May 2024 13:27:40 +0100 Subject: Refactor float `Primitive`s to a separate `Float` type --- compiler/rustc_ty_utils/src/layout.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'compiler/rustc_ty_utils/src/layout.rs') diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index 902b76e8c1e..f78a28d16fd 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -5,7 +5,7 @@ use rustc_index::{IndexSlice, IndexVec}; use rustc_middle::mir::{CoroutineLayout, CoroutineSavedLocal}; use rustc_middle::query::Providers; use rustc_middle::ty::layout::{ - IntegerExt, LayoutCx, LayoutError, LayoutOf, TyAndLayout, MAX_SIMD_LANES, + FloatExt, IntegerExt, LayoutCx, LayoutError, LayoutOf, TyAndLayout, MAX_SIMD_LANES, }; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::{ @@ -180,12 +180,7 @@ fn layout_of_uncached<'tcx>( )), ty::Int(ity) => scalar(Int(Integer::from_int_ty(dl, ity), true)), ty::Uint(ity) => scalar(Int(Integer::from_uint_ty(dl, ity), false)), - ty::Float(fty) => scalar(match fty { - ty::FloatTy::F16 => F16, - ty::FloatTy::F32 => F32, - ty::FloatTy::F64 => F64, - ty::FloatTy::F128 => F128, - }), + ty::Float(fty) => scalar(Float(Float::from_float_ty(fty))), ty::FnPtr(_) => { let mut ptr = scalar_unit(Pointer(dl.instruction_address_space)); ptr.valid_range_mut().start = 1; -- cgit 1.4.1-3-g733a5