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.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user