diff options
| author | Albin Stjerna <albin.stjerna@gmail.com> | 2019-07-19 15:38:54 +0200 |
|---|---|---|
| committer | Albin Stjerna <albin.stjerna@gmail.com> | 2019-09-04 09:46:44 +0200 |
| commit | 6b09477e91ba7cb6b657b87a51ebd0b127e5ca67 (patch) | |
| tree | cd447aa0e3ed54e42bf6604ec129ed8f41d46a73 /src/librustc_mir/dataflow | |
| parent | 996ba932ccd03f2372c5c25eaf5f5025d397a73c (diff) | |
| download | rust-6b09477e91ba7cb6b657b87a51ebd0b127e5ca67.tar.gz rust-6b09477e91ba7cb6b657b87a51ebd0b127e5ca67.zip | |
Polonius: emit initialization/move tracking facts
- var_starts_path - parent - initialized_at - moved_out_at This also switches to the intended emission of `var_drop_used` fact emission, where that fact is always emitted on a drop-use of a variable, regardless of its initialization status, as Polonius now handles that.
Diffstat (limited to 'src/librustc_mir/dataflow')
| -rw-r--r-- | src/librustc_mir/dataflow/move_paths/mod.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index e5a19572170..07b9b662a07 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -1,9 +1,10 @@ use rustc::ty::{Ty, TyCtxt}; use rustc::mir::*; use rustc::util::nodemap::FxHashMap; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_data_structures::indexed_vec::{Idx, IndexVec, Enumerated}; use smallvec::SmallVec; use syntax_pos::{Span}; +use core::slice::Iter; use std::fmt; use std::ops::{Index, IndexMut}; @@ -262,6 +263,12 @@ impl MovePathLookup { pub fn find_local(&self, local: Local) -> MovePathIndex { self.locals[local] } + + /// An enumerated iterator of `local`s and their associated + /// `MovePathIndex`es. + pub fn iter_locals_enumerated(&self) -> Enumerated<Local, Iter<'_, MovePathIndex>> { + self.locals.iter_enumerated() + } } #[derive(Debug)] |
