Skip to content

Commit edfca5f

Browse files
committed
Move branch point upwards to avoid unnecessary mk_ptr()
1 parent 825cf51 commit edfca5f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/librustc_typeck/check/coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,10 +771,10 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
771771
ty::RawPtr(mt) => (false, mt),
772772
_ => return self.unify_and(a, b, identity),
773773
};
774+
coerce_mutbls(mt_a.mutbl, mutbl_b)?;
774775

775776
// Check that the types which they point at are compatible.
776777
let a_unsafe = self.tcx.mk_ptr(ty::TypeAndMut { mutbl: mutbl_b, ty: mt_a.ty });
777-
coerce_mutbls(mt_a.mutbl, mutbl_b)?;
778778
// Although references and unsafe ptrs have the same
779779
// representation, we still register an Adjust::DerefRef so that
780780
// regionck knows that the region for `a` must be valid here.

0 commit comments

Comments
 (0)