Skip to content

Commit 162f04c

Browse files
committed
---
yaml --- r: 136123 b: refs/heads/try c: 36b8502 h: refs/heads/master i: 136121: dad72f8 136119: 0b3cc66 v: v3
1 parent 474db7e commit 162f04c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: b5ba2f5517b1f90d07969ca3facdf5132e42436c
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 749ff5e76a0d08837964e44c66654679a3a88bb8
5-
refs/heads/try: a8577be6f4e2d92b4f397aa8191e4ac48e2b4c6d
5+
refs/heads/try: 36b85025df8a8045428e2f9917c75e0639a210a6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/middle/borrowck/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
602602
span: Span,
603603
kind: AliasableViolationKind,
604604
cause: mc::AliasableReason) {
605+
let mut is_closure = false;
605606
let prefix = match kind {
606607
MutabilityViolation => {
607608
"cannot assign to data"
@@ -625,6 +626,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
625626
}
626627

627628
BorrowViolation(euv::ClosureInvocation) => {
629+
is_closure = true;
628630
"closure invocation"
629631
}
630632

@@ -649,14 +651,20 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
649651
mc::AliasableManaged => {
650652
self.tcx.sess.span_err(
651653
span,
652-
format!("{} in a `@` pointer", prefix).as_slice());
654+
format!("{} in a `Gc` pointer", prefix).as_slice());
653655
}
654656
mc::AliasableBorrowed => {
655657
self.tcx.sess.span_err(
656658
span,
657659
format!("{} in a `&` reference", prefix).as_slice());
658660
}
659661
}
662+
663+
if is_closure {
664+
self.tcx.sess.span_note(
665+
span,
666+
"closures behind references must be called via `&mut`");
667+
}
660668
}
661669

662670
pub fn note_and_explain_bckerr(&self, err: BckError) {

0 commit comments

Comments
 (0)