]> git.lizzy.rs Git - rust.git/commitdiff
Polonius fact generation: fix path access fact location
authorRemy Rakic <remy.rakic@gmail.com>
Sun, 29 Mar 2020 23:13:03 +0000 (01:13 +0200)
committerRemy Rakic <remy.rakic@gmail.com>
Sun, 29 Mar 2020 23:13:03 +0000 (01:13 +0200)
This will fix the other move errors false positives:
emitting the fact at the start point caused accesses to be at the
same point as an initialization fact of the return place of a call
on the following block, which emitted an error.

src/librustc_mir/borrow_check/type_check/liveness/polonius.rs

index 407e0628b6eb8ba6a78a34aaf93fc433d7f2f52b..1c1983fefd4145a8c77a808f98f702f537a70f77 100644 (file)
@@ -43,7 +43,7 @@ fn insert_drop_use(&mut self, local: Local, location: Location) {
 
     fn insert_path_access(&mut self, path: MovePathIndex, location: Location) {
         debug!("UseFactsExtractor::insert_path_access({:?}, {:?})", path, location);
-        self.path_accessed_at_base.push((path, self.location_table.start_index(location)));
+        self.path_accessed_at_base.push((path, self.location_to_index(location)));
     }
 
     fn place_to_mpi(&self, place: &Place<'_>) -> Option<MovePathIndex> {