]> git.lizzy.rs Git - rust.git/commitdiff
mir-borrowck: Add method to MIR borrowck context to retrieve the span of a given...
authorBasile Desloges <basile.desloges@gmail.com>
Thu, 21 Sep 2017 14:13:03 +0000 (16:13 +0200)
committerBasile Desloges <basile.desloges@gmail.com>
Thu, 21 Sep 2017 14:42:30 +0000 (16:42 +0200)
src/librustc_mir/borrow_check.rs

index 063cbc775591540004de493501a424877bfb7161..127ef1f0e0e5f6398d6b1dfbfe57c395bbc3272a 100644 (file)
@@ -1024,6 +1024,13 @@ fn append_lvalue_to_string(&self, lvalue: &Lvalue, buf: &mut String) {
             }
         }
     }
+
+    // Retrieve span of given borrow from the current MIR representation
+    fn retrieve_borrow_span(&self, borrow: &BorrowData) -> Span {
+        self.mir.basic_blocks()[borrow.location.block]
+            .statements[borrow.location.statement_index]
+            .source_info.span
+    }
 }
 
 impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx> {