Skip to content

Commit 5bf9b68

Browse files
committed
---
yaml --- r: 155599 b: refs/heads/try2 c: 36b8502 h: refs/heads/master i: 155597: 4e740d4 155595: 82f2edd 155591: 833f8d3 155583: a2b8d7e v: v3
1 parent 7b6db22 commit 5bf9b68

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: a8577be6f4e2d92b4f397aa8191e4ac48e2b4c6d
8+
refs/heads/try2: 36b85025df8a8045428e2f9917c75e0639a210a6
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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)