Skip to content

Commit 70ef08f

Browse files
committed
mir-borrowck: Add method to MIR borrowck context to retrieve the span of a given borrow
1 parent 35edf7d commit 70ef08f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/librustc_mir/borrow_check.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,13 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
10241024
}
10251025
}
10261026
}
1027+
1028+
// Retrieve span of given borrow from the current MIR representation
1029+
fn retrieve_borrow_span(&self, borrow: &BorrowData) -> Span {
1030+
self.mir.basic_blocks()[borrow.location.block]
1031+
.statements[borrow.location.statement_index]
1032+
.source_info.span
1033+
}
10271034
}
10281035

10291036
impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx> {

0 commit comments

Comments
 (0)