diff options
| author | Donough Liu <ldm2993593805@163.com> | 2020-04-27 01:41:38 +0800 |
|---|---|---|
| committer | Donough Liu <ldm2993593805@163.com> | 2020-04-29 13:06:02 +0800 |
| commit | edfca5fe9c7b6c12a9d48ea2dffd6fffff8501a4 (patch) | |
| tree | 61c77a49679512ac8ae01bb26af6828db7601d00 | |
| parent | 825cf51ad7d2578fcd60a0b7b107d7b0ab3017ff (diff) | |
| download | rust-edfca5fe9c7b6c12a9d48ea2dffd6fffff8501a4.tar.gz rust-edfca5fe9c7b6c12a9d48ea2dffd6fffff8501a4.zip | |
Move branch point upwards to avoid unnecessary mk_ptr()
| -rw-r--r-- | src/librustc_typeck/check/coercion.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 3d665123f67..c1a3ff518b3 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -771,10 +771,10 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { ty::RawPtr(mt) => (false, mt), _ => return self.unify_and(a, b, identity), }; + coerce_mutbls(mt_a.mutbl, mutbl_b)?; // Check that the types which they point at are compatible. let a_unsafe = self.tcx.mk_ptr(ty::TypeAndMut { mutbl: mutbl_b, ty: mt_a.ty }); - coerce_mutbls(mt_a.mutbl, mutbl_b)?; // Although references and unsafe ptrs have the same // representation, we still register an Adjust::DerefRef so that // regionck knows that the region for `a` must be valid here. |
