Auto merge of #122852 - compiler-errors:raw-ptr, r=lcnr
Remove `TypeAndMut` from `ty::RawPtr` variant, make it take `Ty` and `Mutability` Pretty much mechanically converting `ty::RawPtr(ty::TypeAndMut { ty, mutbl })` to `ty::RawPtr(ty, mutbl)` and its fallout. r? lcnr cc rust-lang/types-team#124
This commit is contained in:
commit
7f0f9f6580
@ -677,11 +677,7 @@ pub(crate) fn codegen_drop<'tcx>(
|
||||
|
||||
let arg_value = drop_place.place_ref(
|
||||
fx,
|
||||
fx.layout_of(Ty::new_ref(
|
||||
fx.tcx,
|
||||
fx.tcx.lifetimes.re_erased,
|
||||
TypeAndMut { ty, mutbl: crate::rustc_hir::Mutability::Mut },
|
||||
)),
|
||||
fx.layout_of(Ty::new_mut_ref(fx.tcx, fx.tcx.lifetimes.re_erased, ty)),
|
||||
);
|
||||
let arg_value = adjust_arg_for_abi(fx, arg_value, &fn_abi.args[0], true);
|
||||
|
||||
|
@ -69,7 +69,7 @@ fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<types::Typ
|
||||
FloatTy::F128 => unimplemented!("f16_f128"),
|
||||
},
|
||||
ty::FnPtr(_) => pointer_ty(tcx),
|
||||
ty::RawPtr(TypeAndMut { ty: pointee_ty, mutbl: _ }) | ty::Ref(_, pointee_ty, _) => {
|
||||
ty::RawPtr(pointee_ty, _) | ty::Ref(_, pointee_ty, _) => {
|
||||
if has_ptr_meta(tcx, *pointee_ty) {
|
||||
return None;
|
||||
} else {
|
||||
@ -89,7 +89,7 @@ fn clif_pair_type_from_ty<'tcx>(
|
||||
ty::Tuple(types) if types.len() == 2 => {
|
||||
(clif_type_from_ty(tcx, types[0])?, clif_type_from_ty(tcx, types[1])?)
|
||||
}
|
||||
ty::RawPtr(TypeAndMut { ty: pointee_ty, mutbl: _ }) | ty::Ref(_, pointee_ty, _) => {
|
||||
ty::RawPtr(pointee_ty, _) | ty::Ref(_, pointee_ty, _) => {
|
||||
if has_ptr_meta(tcx, *pointee_ty) {
|
||||
(pointer_ty(tcx), pointer_ty(tcx))
|
||||
} else {
|
||||
|
@ -70,10 +70,8 @@ fn unsize_ptr<'tcx>(
|
||||
) -> (Value, Value) {
|
||||
match (&src_layout.ty.kind(), &dst_layout.ty.kind()) {
|
||||
(&ty::Ref(_, a, _), &ty::Ref(_, b, _))
|
||||
| (&ty::Ref(_, a, _), &ty::RawPtr(ty::TypeAndMut { ty: b, .. }))
|
||||
| (&ty::RawPtr(ty::TypeAndMut { ty: a, .. }), &ty::RawPtr(ty::TypeAndMut { ty: b, .. })) => {
|
||||
(src, unsized_info(fx, *a, *b, old_info))
|
||||
}
|
||||
| (&ty::Ref(_, a, _), &ty::RawPtr(b, _))
|
||||
| (&ty::RawPtr(a, _), &ty::RawPtr(b, _)) => (src, unsized_info(fx, *a, *b, old_info)),
|
||||
(&ty::Adt(def_a, _), &ty::Adt(def_b, _)) => {
|
||||
assert_eq!(def_a, def_b);
|
||||
|
||||
|
@ -865,15 +865,10 @@ pub(crate) fn assert_assignable<'tcx>(
|
||||
return;
|
||||
}
|
||||
match (from_ty.kind(), to_ty.kind()) {
|
||||
(ty::Ref(_, a, _), ty::Ref(_, b, _))
|
||||
| (
|
||||
ty::RawPtr(TypeAndMut { ty: a, mutbl: _ }),
|
||||
ty::RawPtr(TypeAndMut { ty: b, mutbl: _ }),
|
||||
) => {
|
||||
(ty::Ref(_, a, _), ty::Ref(_, b, _)) | (ty::RawPtr(a, _), ty::RawPtr(b, _)) => {
|
||||
assert_assignable(fx, *a, *b, limit - 1);
|
||||
}
|
||||
(ty::Ref(_, a, _), ty::RawPtr(TypeAndMut { ty: b, mutbl: _ }))
|
||||
| (ty::RawPtr(TypeAndMut { ty: a, mutbl: _ }), ty::Ref(_, b, _)) => {
|
||||
(ty::Ref(_, a, _), ty::RawPtr(b, _)) | (ty::RawPtr(a, _), ty::Ref(_, b, _)) => {
|
||||
assert_assignable(fx, *a, *b, limit - 1);
|
||||
}
|
||||
(ty::FnPtr(_), ty::FnPtr(_)) => {
|
||||
|
Loading…
Reference in New Issue
Block a user