From b3290d322e32a1110fd31e9a9ecd246252c1c67c Mon Sep 17 00:00:00 2001 From: Kiet Tran Date: Wed, 22 Jan 2014 00:33:37 -0500 Subject: Make some borrow checker errors more user friendly A mutable and immutable borrow place some restrictions on what you can with the variable until the borrow ends. This commit attempts to convey to the user what those restrictions are. Also, if the original borrow is a mutable borrow, the error message has been changed (more specifically, i. "cannot borrow `x` as immutable because it is also borrowed as mutable" and ii. "cannot borrow `x` as mutable more than once" have been changed to "cannot borrow `x` because it is already borrowed as mutable"). In addition, this adds a (custom) span note to communicate where the original borrow ends. --- src/libsyntax/codemap.rs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/libsyntax/codemap.rs') diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 15146551370..bad95374123 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -311,10 +311,6 @@ impl CodeMap { } } - pub fn adjust_span(&self, sp: Span) -> Span { - sp - } - pub fn span_to_str(&self, sp: Span) -> ~str { { let files = self.files.borrow(); -- cgit 1.4.1-3-g733a5