Skip to content

Commit fa69e21

Browse files
committed
[3f0fb4f] improve comment on to_location
1 parent 2acc3e7 commit fa69e21

File tree

1 file changed

+3
-2
lines changed
  • src/librustc_mir/borrow_check/nll/region_infer

1 file changed

+3
-2
lines changed

src/librustc_mir/borrow_check/nll/region_infer/values.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ impl RegionValueElements {
4747
}
4848
}
4949

50+
/// Converts a `Location` into a `PointIndex`. O(1).
5051
fn point_from_location(&self, location: Location) -> PointIndex {
5152
let Location {
5253
block,
@@ -56,8 +57,8 @@ impl RegionValueElements {
5657
PointIndex::new(start_index + statement_index)
5758
}
5859

59-
/// Converts a particular `RegionElementIndex` to a location, if
60-
/// that is what it represents. Returns `None` otherwise.
60+
/// Converts a `PointIndex` back to a location. O(N) where N is
61+
/// the number of blocks; could be faster if we ever cared.
6162
crate fn to_location(&self, i: PointIndex) -> Location {
6263
let point_index = i.index();
6364

0 commit comments

Comments
 (0)