Skip to content

Commit c7ccea2

Browse files
committed
---
yaml --- r: 135300 b: refs/heads/snap-stage3 c: 36b8502 h: refs/heads/master v: v3
1 parent 846747a commit c7ccea2

File tree

2 files changed

+10
-2
lines changed
  • branches/snap-stage3/src/librustc/middle/borrowck

2 files changed

+10
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 74090504219e4e37c1a6d9fdd8600f44b51c7b04
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a8577be6f4e2d92b4f397aa8191e4ac48e2b4c6d
4+
refs/heads/snap-stage3: 36b85025df8a8045428e2f9917c75e0639a210a6
55
refs/heads/try: 14378ea357c06c23607ca61ade44f60a7a64a1c7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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)