Skip to content

Commit 43aed96

Browse files
committed
add assertion and comment about mutability
1 parent 25988b6 commit 43aed96

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/librustc_typeck/check/coercion.rs

+1
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
367367
// `self.x` both have `&mut `type would be a move of
368368
// `self.x`, but we auto-coerce it to `foo(&mut *self.x)`,
369369
// which is a borrow.
370+
assert_eq!(mt_b.mutbl, hir::MutImmutable); // can only coerce &T -> &U
370371
return self.identity(ty);
371372
}
372373
let r_borrow = match ty.sty {

0 commit comments

Comments
 (0)