@@ -12,12 +12,12 @@ type VarPointRelation = Vec<(Local, LocationIndex)>;
1212type PathPointRelation = Vec < ( MovePathIndex , LocationIndex ) > ;
1313
1414struct UseFactsExtractor < ' me > {
15- var_defined : & ' me mut VarPointRelation ,
16- var_used : & ' me mut VarPointRelation ,
15+ var_defined_at : & ' me mut VarPointRelation ,
16+ var_used_at : & ' me mut VarPointRelation ,
1717 location_table : & ' me LocationTable ,
18- var_drop_used : & ' me mut Vec < ( Local , Location ) > ,
18+ var_dropped_at : & ' me mut VarPointRelation ,
1919 move_data : & ' me MoveData < ' me > ,
20- path_accessed_at : & ' me mut PathPointRelation ,
20+ path_accessed_at_base : & ' me mut PathPointRelation ,
2121}
2222
2323// A Visitor to walk through the MIR and extract point-wise facts
@@ -28,22 +28,22 @@ impl UseFactsExtractor<'_> {
2828
2929 fn insert_def ( & mut self , local : Local , location : Location ) {
3030 debug ! ( "UseFactsExtractor::insert_def()" ) ;
31- self . var_defined . push ( ( local, self . location_to_index ( location) ) ) ;
31+ self . var_defined_at . push ( ( local, self . location_to_index ( location) ) ) ;
3232 }
3333
3434 fn insert_use ( & mut self , local : Local , location : Location ) {
3535 debug ! ( "UseFactsExtractor::insert_use()" ) ;
36- self . var_used . push ( ( local, self . location_to_index ( location) ) ) ;
36+ self . var_used_at . push ( ( local, self . location_to_index ( location) ) ) ;
3737 }
3838
3939 fn insert_drop_use ( & mut self , local : Local , location : Location ) {
4040 debug ! ( "UseFactsExtractor::insert_drop_use()" ) ;
41- self . var_drop_used . push ( ( local, location) ) ;
41+ self . var_dropped_at . push ( ( local, self . location_to_index ( location) ) ) ;
4242 }
4343
4444 fn insert_path_access ( & mut self , path : MovePathIndex , location : Location ) {
4545 debug ! ( "UseFactsExtractor::insert_path_access({:?}, {:?})" , path, location) ;
46- self . path_accessed_at . push ( ( path, self . location_to_index ( location) ) ) ;
46+ self . path_accessed_at_base . push ( ( path, self . location_table . start_index ( location) ) ) ;
4747 }
4848
4949 fn place_to_mpi ( & self , place : & Place < ' _ > ) -> Option < MovePathIndex > {
@@ -88,51 +88,54 @@ pub(super) fn populate_access_facts(
8888 body : ReadOnlyBodyAndCache < ' _ , ' tcx > ,
8989 location_table : & LocationTable ,
9090 move_data : & MoveData < ' _ > ,
91- drop_used : & mut Vec < ( Local , Location ) > ,
91+ dropped_at : & mut Vec < ( Local , Location ) > ,
9292) {
9393 debug ! ( "populate_access_facts()" ) ;
9494
9595 if let Some ( facts) = typeck. borrowck_context . all_facts . as_mut ( ) {
9696 let mut extractor = UseFactsExtractor {
97- var_defined : & mut facts. var_defined ,
98- var_used : & mut facts. var_used ,
99- var_drop_used : drop_used ,
100- path_accessed_at : & mut facts. path_accessed_at ,
97+ var_defined_at : & mut facts. var_defined_at ,
98+ var_used_at : & mut facts. var_used_at ,
99+ var_dropped_at : & mut facts . var_dropped_at ,
100+ path_accessed_at_base : & mut facts. path_accessed_at_base ,
101101 location_table,
102102 move_data,
103103 } ;
104104 extractor. visit_body ( body) ;
105105
106- facts. var_drop_used . extend (
107- drop_used . iter ( ) . map ( |& ( local, location) | ( local, location_table. mid_index ( location) ) ) ,
106+ facts. var_dropped_at . extend (
107+ dropped_at . iter ( ) . map ( |& ( local, location) | ( local, location_table. mid_index ( location) ) ) ,
108108 ) ;
109109
110110 for ( local, local_decl) in body. local_decls . iter_enumerated ( ) {
111- debug ! ( "add var_uses_regions facts - local={:?}, type={:?}" , local, local_decl. ty) ;
111+ debug ! (
112+ "add use_of_var_derefs_origin facts - local={:?}, type={:?}" ,
113+ local, local_decl. ty
114+ ) ;
112115 let _prof_timer = typeck. infcx . tcx . prof . generic_activity ( "polonius_fact_generation" ) ;
113116 let universal_regions = & typeck. borrowck_context . universal_regions ;
114117 typeck. infcx . tcx . for_each_free_region ( & local_decl. ty , |region| {
115118 let region_vid = universal_regions. to_region_vid ( region) ;
116- facts. var_uses_region . push ( ( local, region_vid) ) ;
119+ facts. use_of_var_derefs_origin . push ( ( local, region_vid) ) ;
117120 } ) ;
118121 }
119122 }
120123}
121124
122125// For every potentially drop()-touched region `region` in `local`'s type
123- // (`kind`), emit a Polonius `var_drops_region (local, region )` fact.
124- pub ( super ) fn add_var_drops_regions (
126+ // (`kind`), emit a Polonius `use_of_var_derefs_origin (local, origin )` fact.
127+ pub ( super ) fn add_drop_of_var_derefs_origin (
125128 typeck : & mut TypeChecker < ' _ , ' tcx > ,
126129 local : Local ,
127130 kind : & GenericArg < ' tcx > ,
128131) {
129- debug ! ( "add_var_drops_region (local={:?}, kind={:?}" , local, kind) ;
132+ debug ! ( "add_drop_of_var_derefs_origin (local={:?}, kind={:?}" , local, kind) ;
130133 if let Some ( facts) = typeck. borrowck_context . all_facts . as_mut ( ) {
131134 let _prof_timer = typeck. infcx . tcx . prof . generic_activity ( "polonius_fact_generation" ) ;
132135 let universal_regions = & typeck. borrowck_context . universal_regions ;
133136 typeck. infcx . tcx . for_each_free_region ( kind, |drop_live_region| {
134137 let region_vid = universal_regions. to_region_vid ( drop_live_region) ;
135- facts. var_drops_region . push ( ( local, region_vid) ) ;
138+ facts. drop_of_var_derefs_origin . push ( ( local, region_vid) ) ;
136139 } ) ;
137140 }
138141}
0 commit comments