Skip to content

Commit 7987c42

Browse files
committed
---
yaml --- r: 136873 b: refs/heads/dist-snap c: 36b8502 h: refs/heads/master i: 136871: e157da9 v: v3
1 parent 0a8ac5f commit 7987c42

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
@@ -6,7 +6,7 @@ refs/heads/try: 189b7332968972f34cdbbbd9b62d97ababf53059
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: a8577be6f4e2d92b4f397aa8191e4ac48e2b4c6d
9+
refs/heads/dist-snap: 36b85025df8a8045428e2f9917c75e0639a210a6
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

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