@@ -43,40 +43,38 @@ pub(crate) fn emit_facts<'tcx>(
43
43
universal_region_relations : & UniversalRegionRelations < ' tcx > ,
44
44
constraints : & MirTypeckRegionConstraints < ' tcx > ,
45
45
) {
46
- let Some ( all_facts ) = all_facts else {
46
+ let Some ( facts ) = all_facts else {
47
47
// We don't do anything if there are no facts to fill.
48
48
return ;
49
49
} ;
50
50
let _prof_timer = tcx. prof . generic_activity ( "polonius_fact_generation" ) ;
51
- emit_move_facts ( all_facts , move_data , location_table, body ) ;
52
- emit_universal_region_facts ( all_facts , borrow_set, universal_region_relations) ;
53
- loan_kills:: emit_loan_kills ( tcx, all_facts , location_table , body , borrow_set) ;
54
- loan_invalidations:: emit_loan_invalidations ( tcx, all_facts , location_table , body , borrow_set) ;
51
+ emit_move_facts ( facts , body , location_table, move_data ) ;
52
+ emit_universal_region_facts ( facts , borrow_set, universal_region_relations) ;
53
+ loan_kills:: emit_loan_kills ( tcx, facts , body , location_table , borrow_set) ;
54
+ loan_invalidations:: emit_loan_invalidations ( tcx, facts , body , location_table , borrow_set) ;
55
55
accesses:: emit_access_facts (
56
- all_facts,
57
56
tcx,
57
+ facts,
58
58
body,
59
+ location_table,
59
60
move_data,
60
61
& universal_region_relations. universal_regions ,
61
- location_table,
62
62
) ;
63
- emit_outlives_facts ( all_facts , location_table, constraints) ;
63
+ emit_outlives_facts ( facts , location_table, constraints) ;
64
64
}
65
65
66
66
/// Emit facts needed for move/init analysis: moves and assignments.
67
67
fn emit_move_facts (
68
- all_facts : & mut AllFacts ,
69
- move_data : & MoveData < ' _ > ,
70
- location_table : & LocationTable ,
68
+ facts : & mut AllFacts ,
71
69
body : & Body < ' _ > ,
70
+ location_table : & LocationTable ,
71
+ move_data : & MoveData < ' _ > ,
72
72
) {
73
- all_facts
74
- . path_is_var
75
- . extend ( move_data. rev_lookup . iter_locals_enumerated ( ) . map ( |( l, r) | ( r, l) ) ) ;
73
+ facts. path_is_var . extend ( move_data. rev_lookup . iter_locals_enumerated ( ) . map ( |( l, r) | ( r, l) ) ) ;
76
74
77
75
for ( child, move_path) in move_data. move_paths . iter_enumerated ( ) {
78
76
if let Some ( parent) = move_path. parent {
79
- all_facts . child_path . push ( ( child, parent) ) ;
77
+ facts . child_path . push ( ( child, parent) ) ;
80
78
}
81
79
}
82
80
@@ -102,22 +100,22 @@ fn emit_move_facts(
102
100
// The initialization happened in (or rather, when arriving at)
103
101
// the successors, but not in the unwind block.
104
102
let first_statement = Location { block : successor, statement_index : 0 } ;
105
- all_facts
103
+ facts
106
104
. path_assigned_at_base
107
105
. push ( ( init. path , location_table. start_index ( first_statement) ) ) ;
108
106
}
109
107
} else {
110
108
// In all other cases, the initialization just happens at the
111
109
// midpoint, like any other effect.
112
- all_facts
110
+ facts
113
111
. path_assigned_at_base
114
112
. push ( ( init. path , location_table. mid_index ( location) ) ) ;
115
113
}
116
114
}
117
115
// Arguments are initialized on function entry
118
116
InitLocation :: Argument ( local) => {
119
117
assert ! ( body. local_kind( local) == LocalKind :: Arg ) ;
120
- all_facts . path_assigned_at_base . push ( ( init. path , fn_entry_start) ) ;
118
+ facts . path_assigned_at_base . push ( ( init. path , fn_entry_start) ) ;
121
119
}
122
120
}
123
121
}
@@ -126,20 +124,20 @@ fn emit_move_facts(
126
124
if body. local_kind ( local) != LocalKind :: Arg {
127
125
// Non-arguments start out deinitialised; we simulate this with an
128
126
// initial move:
129
- all_facts . path_moved_at_base . push ( ( path, fn_entry_start) ) ;
127
+ facts . path_moved_at_base . push ( ( path, fn_entry_start) ) ;
130
128
}
131
129
}
132
130
133
131
// moved_out_at
134
132
// deinitialisation is assumed to always happen!
135
- all_facts
133
+ facts
136
134
. path_moved_at_base
137
135
. extend ( move_data. moves . iter ( ) . map ( |mo| ( mo. path , location_table. mid_index ( mo. source ) ) ) ) ;
138
136
}
139
137
140
138
/// Emit universal regions facts, and their relations.
141
139
fn emit_universal_region_facts (
142
- all_facts : & mut AllFacts ,
140
+ facts : & mut AllFacts ,
143
141
borrow_set : & BorrowSet < ' _ > ,
144
142
universal_region_relations : & UniversalRegionRelations < ' _ > ,
145
143
) {
@@ -150,7 +148,7 @@ fn emit_universal_region_facts(
150
148
// added to the existing number of loans, as if they succeeded them in the set.
151
149
//
152
150
let universal_regions = & universal_region_relations. universal_regions ;
153
- all_facts
151
+ facts
154
152
. universal_region
155
153
. extend ( universal_regions. universal_regions_iter ( ) . map ( PoloniusRegionVid :: from) ) ;
156
154
let borrow_count = borrow_set. len ( ) ;
@@ -163,7 +161,7 @@ fn emit_universal_region_facts(
163
161
for universal_region in universal_regions. universal_regions_iter ( ) {
164
162
let universal_region_idx = universal_region. index ( ) ;
165
163
let placeholder_loan_idx = borrow_count + universal_region_idx;
166
- all_facts . placeholder . push ( ( universal_region. into ( ) , placeholder_loan_idx. into ( ) ) ) ;
164
+ facts . placeholder . push ( ( universal_region. into ( ) , placeholder_loan_idx. into ( ) ) ) ;
167
165
}
168
166
169
167
// 2: the universal region relations `outlives` constraints are emitted as
@@ -175,7 +173,7 @@ fn emit_universal_region_facts(
175
173
fr1={:?}, fr2={:?}",
176
174
fr1, fr2
177
175
) ;
178
- all_facts . known_placeholder_subset . push ( ( fr1. into ( ) , fr2. into ( ) ) ) ;
176
+ facts . known_placeholder_subset . push ( ( fr1. into ( ) , fr2. into ( ) ) ) ;
179
177
}
180
178
}
181
179
}
0 commit comments