Use wide pointers consistenly across the compiler
This commit is contained in:
parent
f7c8928f03
commit
018ba0528f
41 changed files with 120 additions and 120 deletions
|
@ -713,17 +713,17 @@ fn codegen_stmt<'tcx>(
|
|||
let from_ty = operand.layout().ty;
|
||||
let to_ty = fx.monomorphize(to_ty);
|
||||
|
||||
fn is_fat_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
fn is_wide_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
ty.builtin_deref(true)
|
||||
.is_some_and(|pointee_ty| has_ptr_meta(fx.tcx, pointee_ty))
|
||||
}
|
||||
|
||||
if is_fat_ptr(fx, from_ty) {
|
||||
if is_fat_ptr(fx, to_ty) {
|
||||
// fat-ptr -> fat-ptr
|
||||
if is_wide_ptr(fx, from_ty) {
|
||||
if is_wide_ptr(fx, to_ty) {
|
||||
// wide-ptr -> wide-ptr
|
||||
lval.write_cvalue(fx, operand.cast_pointer_to(dest_layout));
|
||||
} else {
|
||||
// fat-ptr -> thin-ptr
|
||||
// wide-ptr -> thin-ptr
|
||||
let (ptr, _extra) = operand.load_scalar_pair(fx);
|
||||
lval.write_cvalue(fx, CValue::by_val(ptr, dest_layout))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue