about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRémy Rakic <remy.rakic+github@gmail.com>2024-12-11 14:22:59 +0000
committerRémy Rakic <remy.rakic+github@gmail.com>2024-12-15 14:44:07 +0000
commit2024c5d8697d68c735e253986a5fe29aab8e2b2b (patch)
tree201b2b129b03c0c55bd39a5572125600ae5a0c49
parent1740a5f84a19da866915e53f1dc05a9f929b4b37 (diff)
downloadrust-2024c5d8697d68c735e253986a5fe29aab8e2b2b.tar.gz
rust-2024c5d8697d68c735e253986a5fe29aab8e2b2b.zip
simplify `emit_outlives_facts`
- integrate into `emit_facts` and remove from typeck
-rw-r--r--compiler/rustc_borrowck/src/nll.rs1
-rw-r--r--compiler/rustc_borrowck/src/polonius/legacy/mod.rs11
-rw-r--r--compiler/rustc_borrowck/src/type_check/mod.rs8
3 files changed, 7 insertions, 13 deletions
diff --git a/compiler/rustc_borrowck/src/nll.rs b/compiler/rustc_borrowck/src/nll.rs
index d7ea8e1bcc2..2bd067d4161 100644
--- a/compiler/rustc_borrowck/src/nll.rs
+++ b/compiler/rustc_borrowck/src/nll.rs
@@ -124,6 +124,7 @@ pub(crate) fn compute_regions<'a, 'tcx>(
         borrow_set,
         move_data,
         &universal_region_relations,
+        &constraints,
     );
 
     let mut regioncx = RegionInferenceContext::new(
diff --git a/compiler/rustc_borrowck/src/polonius/legacy/mod.rs b/compiler/rustc_borrowck/src/polonius/legacy/mod.rs
index d1363d98c88..9cf88704e3a 100644
--- a/compiler/rustc_borrowck/src/polonius/legacy/mod.rs
+++ b/compiler/rustc_borrowck/src/polonius/legacy/mod.rs
@@ -41,6 +41,7 @@ pub(crate) fn emit_facts<'tcx>(
     borrow_set: &BorrowSet<'tcx>,
     move_data: &MoveData<'tcx>,
     universal_region_relations: &UniversalRegionRelations<'tcx>,
+    constraints: &MirTypeckRegionConstraints<'tcx>,
 ) {
     let Some(all_facts) = all_facts else {
         // We don't do anything if there are no facts to fill.
@@ -59,6 +60,7 @@ pub(crate) fn emit_facts<'tcx>(
         &universal_region_relations.universal_regions,
         location_table,
     );
+    emit_outlives_facts(all_facts, location_table, constraints);
 }
 
 /// Emit facts needed for move/init analysis: moves and assignments.
@@ -198,14 +200,11 @@ pub(crate) fn emit_drop_facts<'tcx>(
 
 /// Emit facts about the outlives constraints: the `subset` base relation, i.e. not a transitive
 /// closure.
-pub(crate) fn emit_outlives_facts<'tcx>(
-    tcx: TyCtxt<'tcx>,
-    constraints: &MirTypeckRegionConstraints<'tcx>,
+fn emit_outlives_facts<'tcx>(
+    facts: &mut AllFacts,
     location_table: &LocationTable,
-    all_facts: &mut Option<AllFacts>,
+    constraints: &MirTypeckRegionConstraints<'tcx>,
 ) {
-    let Some(facts) = all_facts else { return };
-    let _prof_timer = tcx.prof.generic_activity("polonius_fact_generation");
     facts.subset_base.extend(constraints.outlives_constraints.outlives().iter().flat_map(
         |constraint: &OutlivesConstraint<'_>| {
             if let Some(from_location) = constraint.locations.from_location() {
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs
index 94ef491814d..20668fc3397 100644
--- a/compiler/rustc_borrowck/src/type_check/mod.rs
+++ b/compiler/rustc_borrowck/src/type_check/mod.rs
@@ -59,7 +59,7 @@ use crate::renumber::RegionCtxt;
 use crate::session_diagnostics::{MoveUnsized, SimdIntrinsicArgConst};
 use crate::type_check::free_region_relations::{CreateResult, UniversalRegionRelations};
 use crate::universal_regions::{DefiningTy, UniversalRegions};
-use crate::{BorrowckInferCtxt, path_utils, polonius};
+use crate::{BorrowckInferCtxt, path_utils};
 
 macro_rules! span_mirbug {
     ($context:expr, $elem:expr, $($message:tt)*) => ({
@@ -181,12 +181,6 @@ pub(crate) fn type_check<'a, 'tcx>(
 
     liveness::generate(&mut checker, body, &elements, flow_inits, move_data);
 
-    polonius::legacy::emit_outlives_facts(
-        infcx.tcx,
-        checker.constraints,
-        location_table,
-        checker.all_facts,
-    );
     let opaque_type_values = infcx.take_opaque_types();
 
     let opaque_type_values = opaque_type_values