From 70ef08f213b10e514915e2ab838bc0ff03197758 Mon Sep 17 00:00:00 2001 From: Basile Desloges Date: Thu, 21 Sep 2017 16:13:03 +0200 Subject: [PATCH] mir-borrowck: Add method to MIR borrowck context to retrieve the span of a given borrow --- src/librustc_mir/borrow_check.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/librustc_mir/borrow_check.rs b/src/librustc_mir/borrow_check.rs index 063cbc77559..127ef1f0e0e 100644 --- a/src/librustc_mir/borrow_check.rs +++ b/src/librustc_mir/borrow_check.rs @@ -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> { -- 2.44.0