Skip to content

Commit 2024c5d

Browse files
committed
simplify emit_outlives_facts
- integrate into `emit_facts` and remove from typeck
1 parent 1740a5f commit 2024c5d

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

compiler/rustc_borrowck/src/nll.rs

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ pub(crate) fn compute_regions<'a, 'tcx>(
124124
borrow_set,
125125
move_data,
126126
&universal_region_relations,
127+
&constraints,
127128
);
128129

129130
let mut regioncx = RegionInferenceContext::new(

compiler/rustc_borrowck/src/polonius/legacy/mod.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pub(crate) fn emit_facts<'tcx>(
4141
borrow_set: &BorrowSet<'tcx>,
4242
move_data: &MoveData<'tcx>,
4343
universal_region_relations: &UniversalRegionRelations<'tcx>,
44+
constraints: &MirTypeckRegionConstraints<'tcx>,
4445
) {
4546
let Some(all_facts) = all_facts else {
4647
// We don't do anything if there are no facts to fill.
@@ -59,6 +60,7 @@ pub(crate) fn emit_facts<'tcx>(
5960
&universal_region_relations.universal_regions,
6061
location_table,
6162
);
63+
emit_outlives_facts(all_facts, location_table, constraints);
6264
}
6365

6466
/// Emit facts needed for move/init analysis: moves and assignments.
@@ -198,14 +200,11 @@ pub(crate) fn emit_drop_facts<'tcx>(
198200

199201
/// Emit facts about the outlives constraints: the `subset` base relation, i.e. not a transitive
200202
/// closure.
201-
pub(crate) fn emit_outlives_facts<'tcx>(
202-
tcx: TyCtxt<'tcx>,
203-
constraints: &MirTypeckRegionConstraints<'tcx>,
203+
fn emit_outlives_facts<'tcx>(
204+
facts: &mut AllFacts,
204205
location_table: &LocationTable,
205-
all_facts: &mut Option<AllFacts>,
206+
constraints: &MirTypeckRegionConstraints<'tcx>,
206207
) {
207-
let Some(facts) = all_facts else { return };
208-
let _prof_timer = tcx.prof.generic_activity("polonius_fact_generation");
209208
facts.subset_base.extend(constraints.outlives_constraints.outlives().iter().flat_map(
210209
|constraint: &OutlivesConstraint<'_>| {
211210
if let Some(from_location) = constraint.locations.from_location() {

compiler/rustc_borrowck/src/type_check/mod.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use crate::renumber::RegionCtxt;
5959
use crate::session_diagnostics::{MoveUnsized, SimdIntrinsicArgConst};
6060
use crate::type_check::free_region_relations::{CreateResult, UniversalRegionRelations};
6161
use crate::universal_regions::{DefiningTy, UniversalRegions};
62-
use crate::{BorrowckInferCtxt, path_utils, polonius};
62+
use crate::{BorrowckInferCtxt, path_utils};
6363

6464
macro_rules! span_mirbug {
6565
($context:expr, $elem:expr, $($message:tt)*) => ({
@@ -181,12 +181,6 @@ pub(crate) fn type_check<'a, 'tcx>(
181181

182182
liveness::generate(&mut checker, body, &elements, flow_inits, move_data);
183183

184-
polonius::legacy::emit_outlives_facts(
185-
infcx.tcx,
186-
checker.constraints,
187-
location_table,
188-
checker.all_facts,
189-
);
190184
let opaque_type_values = infcx.take_opaque_types();
191185

192186
let opaque_type_values = opaque_type_values

0 commit comments

Comments
 (0)