1
Fork 0

Format code

This commit is contained in:
Laurențiu Nicola 2025-03-10 11:37:21 +02:00
parent c372c55f2b
commit 1d983bf794

View file

@ -6,9 +6,8 @@ use base_db::ra_salsa::Cycle;
use chalk_ir::{AdtId, FloatTy, IntTy, TyKind, UintTy}; use chalk_ir::{AdtId, FloatTy, IntTy, TyKind, UintTy};
use hir_def::{ use hir_def::{
layout::{ layout::{
Float, Integer, LayoutCalculator, LayoutCalculatorError, Float, Integer, LayoutCalculator, LayoutCalculatorError, LayoutData, Primitive,
LayoutData, Primitive, ReprOptions, Scalar, StructKind, TargetDataLayout, ReprOptions, Scalar, StructKind, TargetDataLayout, WrappingRange,
WrappingRange,
}, },
LocalFieldId, StructId, LocalFieldId, StructId,
}; };
@ -192,43 +191,52 @@ pub fn layout_of_ty_query(
valid_range: WrappingRange { start: 0, end: 0x10FFFF }, valid_range: WrappingRange { start: 0, end: 0x10FFFF },
}, },
), ),
chalk_ir::Scalar::Int(i) => Layout::scalar(dl, scalar_unit( chalk_ir::Scalar::Int(i) => Layout::scalar(
dl, dl,
Primitive::Int( scalar_unit(
match i { dl,
IntTy::Isize => dl.ptr_sized_integer(), Primitive::Int(
IntTy::I8 => Integer::I8, match i {
IntTy::I16 => Integer::I16, IntTy::Isize => dl.ptr_sized_integer(),
IntTy::I32 => Integer::I32, IntTy::I8 => Integer::I8,
IntTy::I64 => Integer::I64, IntTy::I16 => Integer::I16,
IntTy::I128 => Integer::I128, IntTy::I32 => Integer::I32,
}, IntTy::I64 => Integer::I64,
true, IntTy::I128 => Integer::I128,
},
true,
),
), ),
)), ),
chalk_ir::Scalar::Uint(i) => Layout::scalar(dl, scalar_unit( chalk_ir::Scalar::Uint(i) => Layout::scalar(
dl, dl,
Primitive::Int( scalar_unit(
match i { dl,
UintTy::Usize => dl.ptr_sized_integer(), Primitive::Int(
UintTy::U8 => Integer::I8, match i {
UintTy::U16 => Integer::I16, UintTy::Usize => dl.ptr_sized_integer(),
UintTy::U32 => Integer::I32, UintTy::U8 => Integer::I8,
UintTy::U64 => Integer::I64, UintTy::U16 => Integer::I16,
UintTy::U128 => Integer::I128, UintTy::U32 => Integer::I32,
}, UintTy::U64 => Integer::I64,
false, UintTy::U128 => Integer::I128,
},
false,
),
), ),
)), ),
chalk_ir::Scalar::Float(f) => Layout::scalar(dl, scalar_unit( chalk_ir::Scalar::Float(f) => Layout::scalar(
dl, dl,
Primitive::Float(match f { scalar_unit(
FloatTy::F16 => Float::F16, dl,
FloatTy::F32 => Float::F32, Primitive::Float(match f {
FloatTy::F64 => Float::F64, FloatTy::F16 => Float::F16,
FloatTy::F128 => Float::F128, FloatTy::F32 => Float::F32,
}), FloatTy::F64 => Float::F64,
)), FloatTy::F128 => Float::F128,
}),
),
),
}, },
TyKind::Tuple(len, tys) => { TyKind::Tuple(len, tys) => {
let kind = if *len == 0 { StructKind::AlwaysSized } else { StructKind::MaybeUnsized }; let kind = if *len == 0 { StructKind::AlwaysSized } else { StructKind::MaybeUnsized };