diff options
Diffstat (limited to 'compiler/rustc_hir_analysis/src/coherence/builtin.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/coherence/builtin.rs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs index 8d8b13d6cb3..cf32b599e02 100644 --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs @@ -195,7 +195,7 @@ fn visit_implementation_of_dispatch_from_dyn(checker: &Checker<'_>) -> Result<() { Ok(()) } - (&RawPtr(tm_a), &RawPtr(tm_b)) if tm_a.mutbl == tm_b.mutbl => Ok(()), + (&RawPtr(_, a_mutbl), &RawPtr(_, b_mutbl)) if a_mutbl == b_mutbl => Ok(()), (&Adt(def_a, args_a), &Adt(def_b, args_b)) if def_a.is_struct() && def_b.is_struct() => { if def_a != def_b { let source_path = tcx.def_path_str(def_a.did()); @@ -351,14 +351,17 @@ pub fn coerce_unsized_info<'tcx>( check_mutbl(mt_a, mt_b, &|ty| Ty::new_imm_ref(tcx, r_b, ty)) } - (&ty::Ref(_, ty_a, mutbl_a), &ty::RawPtr(mt_b)) => { - let mt_a = ty::TypeAndMut { ty: ty_a, mutbl: mutbl_a }; - check_mutbl(mt_a, mt_b, &|ty| Ty::new_imm_ptr(tcx, ty)) - } - - (&ty::RawPtr(mt_a), &ty::RawPtr(mt_b)) => { - check_mutbl(mt_a, mt_b, &|ty| Ty::new_imm_ptr(tcx, ty)) - } + (&ty::Ref(_, ty_a, mutbl_a), &ty::RawPtr(ty_b, mutbl_b)) => check_mutbl( + ty::TypeAndMut { ty: ty_a, mutbl: mutbl_a }, + ty::TypeAndMut { ty: ty_b, mutbl: mutbl_b }, + &|ty| Ty::new_imm_ptr(tcx, ty), + ), + + (&ty::RawPtr(ty_a, mutbl_a), &ty::RawPtr(ty_b, mutbl_b)) => check_mutbl( + ty::TypeAndMut { ty: ty_a, mutbl: mutbl_a }, + ty::TypeAndMut { ty: ty_b, mutbl: mutbl_b }, + &|ty| Ty::new_imm_ptr(tcx, ty), + ), (&ty::Adt(def_a, args_a), &ty::Adt(def_b, args_b)) if def_a.is_struct() && def_b.is_struct() => |
