about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-01 07:22:18 +0000
committerbors <bors@rust-lang.org>2014-10-01 07:22:18 +0000
commit60e7317345f246a8169bbfe721473f693d54cade (patch)
treeffd2472717f972aaca1d50b73a531c5d1dbfd150 /src/libsyntax
parentfe93a549a49983837747986797a40d85ba047cad (diff)
parent496cc4c0d4a06047c4f78965c8bc6e2c812c7812 (diff)
downloadrust-60e7317345f246a8169bbfe721473f693d54cade.tar.gz
rust-60e7317345f246a8169bbfe721473f693d54cade.zip
auto merge of #17501 : pcwalton/rust/improve-method-lookup-autoderef, r=nikomatsakis
prefer `Deref` over `DerefMut` in all other circumstances.

Because the compiler now prefers `Deref`, this can break code that
looked like:

    let mut foo = bar.borrow_mut();
    (*foo).call_something_that_requires_mutable_self();

Replace this code with:

    let mut foo = bar.baz();
    (&mut *foo).call_something_that_requires_mutable_self();

Closes #12825.

[breaking-change]

r? @nikomatsakis
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/codemap.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index e9b2556c53e..cd215c1d68c 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -290,6 +290,9 @@ impl FileMap {
     }
 
     /// get a line from the list of pre-computed line-beginnings
+    ///
+    /// NOTE(stage0, pcwalton): Remove `#[allow(unused_mut)]` after snapshot.
+    #[allow(unused_mut)]
     pub fn get_line(&self, line: int) -> String {
         let mut lines = self.lines.borrow_mut();
         let begin: BytePos = *lines.get(line as uint) - self.start_pos;
@@ -512,6 +515,8 @@ impl CodeMap {
         return a;
     }
 
+    // NOTE(stage0, pcwalton): Remove `#[allow(unused_mut)]` after snapshot.
+    #[allow(unused_mut)]
     fn lookup_line(&self, pos: BytePos) -> FileMapAndLine {
         let idx = self.lookup_filemap_idx(pos);