@@ -12,12 +12,12 @@ type VarPointRelation = Vec<(Local, LocationIndex)>;
12
12
type PathPointRelation = Vec < ( MovePathIndex , LocationIndex ) > ;
13
13
14
14
struct 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 ,
17
17
location_table : & ' me LocationTable ,
18
- var_drop_used : & ' me mut Vec < ( Local , Location ) > ,
18
+ var_dropped_at : & ' me mut VarPointRelation ,
19
19
move_data : & ' me MoveData < ' me > ,
20
- path_accessed_at : & ' me mut PathPointRelation ,
20
+ path_accessed_at_base : & ' me mut PathPointRelation ,
21
21
}
22
22
23
23
// A Visitor to walk through the MIR and extract point-wise facts
@@ -28,22 +28,22 @@ impl UseFactsExtractor<'_> {
28
28
29
29
fn insert_def ( & mut self , local : Local , location : Location ) {
30
30
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) ) ) ;
32
32
}
33
33
34
34
fn insert_use ( & mut self , local : Local , location : Location ) {
35
35
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) ) ) ;
37
37
}
38
38
39
39
fn insert_drop_use ( & mut self , local : Local , location : Location ) {
40
40
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) ) ) ;
42
42
}
43
43
44
44
fn insert_path_access ( & mut self , path : MovePathIndex , location : Location ) {
45
45
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) ) ) ;
47
47
}
48
48
49
49
fn place_to_mpi ( & self , place : & Place < ' _ > ) -> Option < MovePathIndex > {
@@ -88,51 +88,54 @@ pub(super) fn populate_access_facts(
88
88
body : ReadOnlyBodyAndCache < ' _ , ' tcx > ,
89
89
location_table : & LocationTable ,
90
90
move_data : & MoveData < ' _ > ,
91
- drop_used : & mut Vec < ( Local , Location ) > ,
91
+ dropped_at : & mut Vec < ( Local , Location ) > ,
92
92
) {
93
93
debug ! ( "populate_access_facts()" ) ;
94
94
95
95
if let Some ( facts) = typeck. borrowck_context . all_facts . as_mut ( ) {
96
96
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 ,
101
101
location_table,
102
102
move_data,
103
103
} ;
104
104
extractor. visit_body ( body) ;
105
105
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) ) ) ,
108
108
) ;
109
109
110
110
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
+ ) ;
112
115
let _prof_timer = typeck. infcx . tcx . prof . generic_activity ( "polonius_fact_generation" ) ;
113
116
let universal_regions = & typeck. borrowck_context . universal_regions ;
114
117
typeck. infcx . tcx . for_each_free_region ( & local_decl. ty , |region| {
115
118
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) ) ;
117
120
} ) ;
118
121
}
119
122
}
120
123
}
121
124
122
125
// 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 (
125
128
typeck : & mut TypeChecker < ' _ , ' tcx > ,
126
129
local : Local ,
127
130
kind : & GenericArg < ' tcx > ,
128
131
) {
129
- debug ! ( "add_var_drops_region (local={:?}, kind={:?}" , local, kind) ;
132
+ debug ! ( "add_drop_of_var_derefs_origin (local={:?}, kind={:?}" , local, kind) ;
130
133
if let Some ( facts) = typeck. borrowck_context . all_facts . as_mut ( ) {
131
134
let _prof_timer = typeck. infcx . tcx . prof . generic_activity ( "polonius_fact_generation" ) ;
132
135
let universal_regions = & typeck. borrowck_context . universal_regions ;
133
136
typeck. infcx . tcx . for_each_free_region ( kind, |drop_live_region| {
134
137
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) ) ;
136
139
} ) ;
137
140
}
138
141
}
0 commit comments