@@ -43,40 +43,38 @@ pub(crate) fn emit_facts<'tcx>(
4343 universal_region_relations : & UniversalRegionRelations < ' tcx > ,
4444 constraints : & MirTypeckRegionConstraints < ' tcx > ,
4545) {
46- let Some ( all_facts ) = all_facts else {
46+ let Some ( facts ) = all_facts else {
4747 // We don't do anything if there are no facts to fill.
4848 return ;
4949 } ;
5050 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) ;
5555 accesses:: emit_access_facts (
56- all_facts,
5756 tcx,
57+ facts,
5858 body,
59+ location_table,
5960 move_data,
6061 & universal_region_relations. universal_regions ,
61- location_table,
6262 ) ;
63- emit_outlives_facts ( all_facts , location_table, constraints) ;
63+ emit_outlives_facts ( facts , location_table, constraints) ;
6464}
6565
6666/// Emit facts needed for move/init analysis: moves and assignments.
6767fn emit_move_facts (
68- all_facts : & mut AllFacts ,
69- move_data : & MoveData < ' _ > ,
70- location_table : & LocationTable ,
68+ facts : & mut AllFacts ,
7169 body : & Body < ' _ > ,
70+ location_table : & LocationTable ,
71+ move_data : & MoveData < ' _ > ,
7272) {
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) ) ) ;
7674
7775 for ( child, move_path) in move_data. move_paths . iter_enumerated ( ) {
7876 if let Some ( parent) = move_path. parent {
79- all_facts . child_path . push ( ( child, parent) ) ;
77+ facts . child_path . push ( ( child, parent) ) ;
8078 }
8179 }
8280
@@ -102,22 +100,22 @@ fn emit_move_facts(
102100 // The initialization happened in (or rather, when arriving at)
103101 // the successors, but not in the unwind block.
104102 let first_statement = Location { block : successor, statement_index : 0 } ;
105- all_facts
103+ facts
106104 . path_assigned_at_base
107105 . push ( ( init. path , location_table. start_index ( first_statement) ) ) ;
108106 }
109107 } else {
110108 // In all other cases, the initialization just happens at the
111109 // midpoint, like any other effect.
112- all_facts
110+ facts
113111 . path_assigned_at_base
114112 . push ( ( init. path , location_table. mid_index ( location) ) ) ;
115113 }
116114 }
117115 // Arguments are initialized on function entry
118116 InitLocation :: Argument ( local) => {
119117 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) ) ;
121119 }
122120 }
123121 }
@@ -126,20 +124,20 @@ fn emit_move_facts(
126124 if body. local_kind ( local) != LocalKind :: Arg {
127125 // Non-arguments start out deinitialised; we simulate this with an
128126 // 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) ) ;
130128 }
131129 }
132130
133131 // moved_out_at
134132 // deinitialisation is assumed to always happen!
135- all_facts
133+ facts
136134 . path_moved_at_base
137135 . extend ( move_data. moves . iter ( ) . map ( |mo| ( mo. path , location_table. mid_index ( mo. source ) ) ) ) ;
138136}
139137
140138/// Emit universal regions facts, and their relations.
141139fn emit_universal_region_facts (
142- all_facts : & mut AllFacts ,
140+ facts : & mut AllFacts ,
143141 borrow_set : & BorrowSet < ' _ > ,
144142 universal_region_relations : & UniversalRegionRelations < ' _ > ,
145143) {
@@ -150,7 +148,7 @@ fn emit_universal_region_facts(
150148 // added to the existing number of loans, as if they succeeded them in the set.
151149 //
152150 let universal_regions = & universal_region_relations. universal_regions ;
153- all_facts
151+ facts
154152 . universal_region
155153 . extend ( universal_regions. universal_regions_iter ( ) . map ( PoloniusRegionVid :: from) ) ;
156154 let borrow_count = borrow_set. len ( ) ;
@@ -163,7 +161,7 @@ fn emit_universal_region_facts(
163161 for universal_region in universal_regions. universal_regions_iter ( ) {
164162 let universal_region_idx = universal_region. index ( ) ;
165163 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 ( ) ) ) ;
167165 }
168166
169167 // 2: the universal region relations `outlives` constraints are emitted as
@@ -175,7 +173,7 @@ fn emit_universal_region_facts(
175173 fr1={:?}, fr2={:?}",
176174 fr1, fr2
177175 ) ;
178- all_facts . known_placeholder_subset . push ( ( fr1. into ( ) , fr2. into ( ) ) ) ;
176+ facts . known_placeholder_subset . push ( ( fr1. into ( ) , fr2. into ( ) ) ) ;
179177 }
180178 }
181179}
0 commit comments