|
3 | 3 | use std::rc::Rc; |
4 | 4 | use std::{fmt, iter, mem}; |
5 | 5 |
|
6 | | -use either::Either; |
7 | 6 | use rustc_abi::{FIRST_VARIANT, FieldIdx}; |
8 | 7 | use rustc_data_structures::frozen::Frozen; |
9 | 8 | use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; |
@@ -60,7 +59,7 @@ use crate::renumber::RegionCtxt; |
60 | 59 | use crate::session_diagnostics::{MoveUnsized, SimdIntrinsicArgConst}; |
61 | 60 | use crate::type_check::free_region_relations::{CreateResult, UniversalRegionRelations}; |
62 | 61 | use crate::universal_regions::{DefiningTy, UniversalRegions}; |
63 | | -use crate::{BorrowckInferCtxt, path_utils}; |
| 62 | +use crate::{BorrowckInferCtxt, path_utils, polonius}; |
64 | 63 |
|
65 | 64 | macro_rules! span_mirbug { |
66 | 65 | ($context:expr, $elem:expr, $($message:tt)*) => ({ |
@@ -182,7 +181,20 @@ pub(crate) fn type_check<'a, 'tcx>( |
182 | 181 |
|
183 | 182 | liveness::generate(&mut checker, body, &elements, flow_inits, move_data); |
184 | 183 |
|
185 | | - translate_outlives_facts(&mut checker); |
| 184 | + polonius::legacy::emit_access_facts( |
| 185 | + infcx.tcx, |
| 186 | + body, |
| 187 | + move_data, |
| 188 | + &universal_region_relations.universal_regions, |
| 189 | + location_table, |
| 190 | + checker.all_facts, |
| 191 | + ); |
| 192 | + polonius::legacy::emit_outlives_facts( |
| 193 | + infcx.tcx, |
| 194 | + checker.constraints, |
| 195 | + location_table, |
| 196 | + checker.all_facts, |
| 197 | + ); |
186 | 198 | let opaque_type_values = infcx.take_opaque_types(); |
187 | 199 |
|
188 | 200 | let opaque_type_values = opaque_type_values |
@@ -234,30 +246,6 @@ pub(crate) fn type_check<'a, 'tcx>( |
234 | 246 | MirTypeckResults { constraints, universal_region_relations, opaque_type_values } |
235 | 247 | } |
236 | 248 |
|
237 | | -fn translate_outlives_facts(typeck: &mut TypeChecker<'_, '_>) { |
238 | | - if let Some(facts) = typeck.all_facts { |
239 | | - let _prof_timer = typeck.infcx.tcx.prof.generic_activity("polonius_fact_generation"); |
240 | | - let location_table = typeck.location_table; |
241 | | - facts.subset_base.extend( |
242 | | - typeck.constraints.outlives_constraints.outlives().iter().flat_map( |
243 | | - |constraint: &OutlivesConstraint<'_>| { |
244 | | - if let Some(from_location) = constraint.locations.from_location() { |
245 | | - Either::Left(iter::once(( |
246 | | - constraint.sup.into(), |
247 | | - constraint.sub.into(), |
248 | | - location_table.mid_index(from_location), |
249 | | - ))) |
250 | | - } else { |
251 | | - Either::Right(location_table.all_points().map(move |location| { |
252 | | - (constraint.sup.into(), constraint.sub.into(), location) |
253 | | - })) |
254 | | - } |
255 | | - }, |
256 | | - ), |
257 | | - ); |
258 | | - } |
259 | | -} |
260 | | - |
261 | 249 | #[track_caller] |
262 | 250 | fn mirbug(tcx: TyCtxt<'_>, span: Span, msg: String) { |
263 | 251 | // We sometimes see MIR failures (notably predicate failures) due to |
|
0 commit comments