about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2016-03-18 18:40:22 -0400
committerNiko Matsakis <niko@alum.mit.edu>2016-03-18 18:40:22 -0400
commit43aed96d0da2cfa6e5da3058c107f3de4a3c009b (patch)
tree2a5bd82ddf970e891b192c0c89ebfa01f0e0d772 /src
parent25988b645dfa5f56d35a4428e8c5e8c67706aaf4 (diff)
downloadrust-43aed96d0da2cfa6e5da3058c107f3de4a3c009b.tar.gz
rust-43aed96d0da2cfa6e5da3058c107f3de4a3c009b.zip
add assertion and comment about mutability
Diffstat (limited to 'src')
-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 {