about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_typeck/check/coercion.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs
index 164503980cd..bb27333025e 100644
--- a/src/librustc_typeck/check/coercion.rs
+++ b/src/librustc_typeck/check/coercion.rs
@@ -367,6 +367,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
             // `self.x` both have `&mut `type would be a move of
             // `self.x`, but we auto-coerce it to `foo(&mut *self.x)`,
             // which is a borrow.
+            assert_eq!(mt_b.mutbl, hir::MutImmutable); // can only coerce &T -> &U
             return self.identity(ty);
         }
         let r_borrow = match ty.sty {