mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
rename LocationTable
to PoloniusLocationTable
Its original naming hides the fact that it's related to datalog polonius, and bound to be deleted in the near future. It also conflicts with the expected name for the actual NLL location map, and prefixing it with its use will make the differentiation possible.
This commit is contained in:
parent
6f1c4177e7
commit
3a1a621115
@ -11,8 +11,8 @@ pub use super::dataflow::{BorrowIndex, Borrows, calculate_borrows_out_of_scope_a
|
||||
pub use super::place_ext::PlaceExt;
|
||||
pub use super::places_conflict::{PlaceConflictBias, places_conflict};
|
||||
pub use super::polonius::legacy::{
|
||||
AllFacts as PoloniusInput, LocationTable, PoloniusOutput, PoloniusRegionVid, RichLocation,
|
||||
RustcFacts,
|
||||
AllFacts as PoloniusInput, PoloniusLocationTable, PoloniusOutput, PoloniusRegionVid,
|
||||
RichLocation, RustcFacts,
|
||||
};
|
||||
pub use super::region_infer::RegionInferenceContext;
|
||||
|
||||
@ -33,7 +33,7 @@ pub enum ConsumerOptions {
|
||||
/// without significant slowdowns.
|
||||
///
|
||||
/// Implies [`RegionInferenceContext`](ConsumerOptions::RegionInferenceContext),
|
||||
/// and additionally retrieve the [`LocationTable`] and [`PoloniusInput`] that
|
||||
/// and additionally retrieve the [`PoloniusLocationTable`] and [`PoloniusInput`] that
|
||||
/// would be given to Polonius. Critically, this does not run Polonius, which
|
||||
/// one may want to avoid due to performance issues on large bodies.
|
||||
PoloniusInputFacts,
|
||||
@ -71,7 +71,7 @@ pub struct BodyWithBorrowckFacts<'tcx> {
|
||||
/// The table that maps Polonius points to locations in the table.
|
||||
/// Populated when using [`ConsumerOptions::PoloniusInputFacts`]
|
||||
/// or [`ConsumerOptions::PoloniusOutputFacts`].
|
||||
pub location_table: Option<LocationTable>,
|
||||
pub location_table: Option<PoloniusLocationTable>,
|
||||
/// Polonius input facts.
|
||||
/// Populated when using [`ConsumerOptions::PoloniusInputFacts`]
|
||||
/// or [`ConsumerOptions::PoloniusOutputFacts`].
|
||||
|
@ -56,7 +56,7 @@ use crate::diagnostics::{
|
||||
use crate::path_utils::*;
|
||||
use crate::place_ext::PlaceExt;
|
||||
use crate::places_conflict::{PlaceConflictBias, places_conflict};
|
||||
use crate::polonius::legacy::{LocationTable, PoloniusOutput};
|
||||
use crate::polonius::legacy::{PoloniusLocationTable, PoloniusOutput};
|
||||
use crate::prefixes::PrefixSet;
|
||||
use crate::region_infer::RegionInferenceContext;
|
||||
use crate::renumber::RegionCtxt;
|
||||
@ -175,7 +175,7 @@ fn do_mir_borrowck<'tcx>(
|
||||
infcx.register_predefined_opaques_for_next_solver(def);
|
||||
}
|
||||
|
||||
let location_table = LocationTable::new(body);
|
||||
let location_table = PoloniusLocationTable::new(body);
|
||||
|
||||
let move_data = MoveData::gather_moves(body, tcx, |_| true);
|
||||
let promoted_move_data = promoted
|
||||
@ -246,7 +246,8 @@ fn do_mir_borrowck<'tcx>(
|
||||
infcx: &infcx,
|
||||
body: promoted_body,
|
||||
move_data: &move_data,
|
||||
location_table: &location_table, // no need to create a real one for the promoted, it is not used
|
||||
// no need to create a real location table for the promoted, it is not used
|
||||
location_table: &location_table,
|
||||
movable_coroutine,
|
||||
fn_self_span_reported: Default::default(),
|
||||
locals_are_invalidated_at_exit,
|
||||
@ -512,7 +513,7 @@ struct MirBorrowckCtxt<'a, 'infcx, 'tcx> {
|
||||
|
||||
/// Map from MIR `Location` to `LocationIndex`; created
|
||||
/// when MIR borrowck begins.
|
||||
location_table: &'a LocationTable,
|
||||
location_table: &'a PoloniusLocationTable,
|
||||
|
||||
movable_coroutine: bool,
|
||||
/// This keeps track of whether local variables are free-ed when the function
|
||||
|
@ -28,7 +28,7 @@ use crate::borrow_set::BorrowSet;
|
||||
use crate::consumers::ConsumerOptions;
|
||||
use crate::diagnostics::{BorrowckDiagnosticsBuffer, RegionErrors};
|
||||
use crate::polonius::LocalizedOutlivesConstraintSet;
|
||||
use crate::polonius::legacy::{AllFacts, AllFactsExt, LocationTable, PoloniusOutput};
|
||||
use crate::polonius::legacy::{AllFacts, AllFactsExt, PoloniusLocationTable, PoloniusOutput};
|
||||
use crate::region_infer::RegionInferenceContext;
|
||||
use crate::type_check::{self, MirTypeckResults};
|
||||
use crate::universal_regions::UniversalRegions;
|
||||
@ -80,7 +80,7 @@ pub(crate) fn compute_regions<'a, 'tcx>(
|
||||
universal_regions: UniversalRegions<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
promoted: &IndexSlice<Promoted, Body<'tcx>>,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
flow_inits: ResultsCursor<'a, 'tcx, MaybeInitializedPlaces<'a, 'tcx>>,
|
||||
move_data: &MoveData<'tcx>,
|
||||
borrow_set: &BorrowSet<'tcx>,
|
||||
|
@ -4,7 +4,7 @@ use rustc_middle::ty::TyCtxt;
|
||||
use rustc_mir_dataflow::move_paths::{LookupResult, MoveData};
|
||||
use tracing::debug;
|
||||
|
||||
use super::{AllFacts, LocationIndex, LocationTable};
|
||||
use super::{AllFacts, LocationIndex, PoloniusLocationTable};
|
||||
use crate::def_use::{self, DefUse};
|
||||
use crate::universal_regions::UniversalRegions;
|
||||
|
||||
@ -13,7 +13,7 @@ pub(crate) fn emit_access_facts<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
facts: &mut AllFacts,
|
||||
body: &Body<'tcx>,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
move_data: &MoveData<'tcx>,
|
||||
universal_regions: &UniversalRegions<'tcx>,
|
||||
) {
|
||||
@ -33,7 +33,7 @@ pub(crate) fn emit_access_facts<'tcx>(
|
||||
struct AccessFactsExtractor<'a, 'tcx> {
|
||||
facts: &'a mut AllFacts,
|
||||
move_data: &'a MoveData<'tcx>,
|
||||
location_table: &'a LocationTable,
|
||||
location_table: &'a PoloniusLocationTable,
|
||||
}
|
||||
|
||||
impl<'tcx> AccessFactsExtractor<'_, 'tcx> {
|
||||
|
@ -10,7 +10,7 @@ use rustc_middle::mir::Local;
|
||||
use rustc_middle::ty::{RegionVid, TyCtxt};
|
||||
use rustc_mir_dataflow::move_paths::MovePathIndex;
|
||||
|
||||
use super::{LocationIndex, LocationTable};
|
||||
use super::{LocationIndex, PoloniusLocationTable};
|
||||
use crate::BorrowIndex;
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
@ -63,7 +63,7 @@ impl AllFacts {
|
||||
fn write_to_dir(
|
||||
&self,
|
||||
dir: impl AsRef<Path>,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
let dir: &Path = dir.as_ref();
|
||||
fs::create_dir_all(dir)?;
|
||||
@ -119,7 +119,7 @@ impl Atom for LocationIndex {
|
||||
}
|
||||
|
||||
struct FactWriter<'w> {
|
||||
location_table: &'w LocationTable,
|
||||
location_table: &'w PoloniusLocationTable,
|
||||
dir: &'w Path,
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ trait FactRow {
|
||||
fn write(
|
||||
&self,
|
||||
out: &mut dyn Write,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
) -> Result<(), Box<dyn Error>>;
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ impl FactRow for PoloniusRegionVid {
|
||||
fn write(
|
||||
&self,
|
||||
out: &mut dyn Write,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
write_row(out, location_table, &[self])
|
||||
}
|
||||
@ -163,7 +163,7 @@ where
|
||||
fn write(
|
||||
&self,
|
||||
out: &mut dyn Write,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
write_row(out, location_table, &[&self.0, &self.1])
|
||||
}
|
||||
@ -178,7 +178,7 @@ where
|
||||
fn write(
|
||||
&self,
|
||||
out: &mut dyn Write,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
write_row(out, location_table, &[&self.0, &self.1, &self.2])
|
||||
}
|
||||
@ -194,7 +194,7 @@ where
|
||||
fn write(
|
||||
&self,
|
||||
out: &mut dyn Write,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
write_row(out, location_table, &[&self.0, &self.1, &self.2, &self.3])
|
||||
}
|
||||
@ -202,7 +202,7 @@ where
|
||||
|
||||
fn write_row(
|
||||
out: &mut dyn Write,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
columns: &[&dyn FactCell],
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
for (index, c) in columns.iter().enumerate() {
|
||||
@ -213,41 +213,41 @@ fn write_row(
|
||||
}
|
||||
|
||||
trait FactCell {
|
||||
fn to_string(&self, location_table: &LocationTable) -> String;
|
||||
fn to_string(&self, location_table: &PoloniusLocationTable) -> String;
|
||||
}
|
||||
|
||||
impl FactCell for BorrowIndex {
|
||||
fn to_string(&self, _location_table: &LocationTable) -> String {
|
||||
fn to_string(&self, _location_table: &PoloniusLocationTable) -> String {
|
||||
format!("{self:?}")
|
||||
}
|
||||
}
|
||||
|
||||
impl FactCell for Local {
|
||||
fn to_string(&self, _location_table: &LocationTable) -> String {
|
||||
fn to_string(&self, _location_table: &PoloniusLocationTable) -> String {
|
||||
format!("{self:?}")
|
||||
}
|
||||
}
|
||||
|
||||
impl FactCell for MovePathIndex {
|
||||
fn to_string(&self, _location_table: &LocationTable) -> String {
|
||||
fn to_string(&self, _location_table: &PoloniusLocationTable) -> String {
|
||||
format!("{self:?}")
|
||||
}
|
||||
}
|
||||
|
||||
impl FactCell for PoloniusRegionVid {
|
||||
fn to_string(&self, _location_table: &LocationTable) -> String {
|
||||
fn to_string(&self, _location_table: &PoloniusLocationTable) -> String {
|
||||
format!("{self:?}")
|
||||
}
|
||||
}
|
||||
|
||||
impl FactCell for RegionVid {
|
||||
fn to_string(&self, _location_table: &LocationTable) -> String {
|
||||
fn to_string(&self, _location_table: &PoloniusLocationTable) -> String {
|
||||
format!("{self:?}")
|
||||
}
|
||||
}
|
||||
|
||||
impl FactCell for LocationIndex {
|
||||
fn to_string(&self, location_table: &LocationTable) -> String {
|
||||
fn to_string(&self, location_table: &PoloniusLocationTable) -> String {
|
||||
format!("{:?}", location_table.to_rich_location(*self))
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ use rustc_middle::mir::{
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use tracing::debug;
|
||||
|
||||
use super::{AllFacts, LocationTable};
|
||||
use super::{AllFacts, PoloniusLocationTable};
|
||||
use crate::borrow_set::BorrowSet;
|
||||
use crate::path_utils::*;
|
||||
use crate::{
|
||||
@ -24,7 +24,7 @@ pub(super) fn emit_loan_invalidations<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
facts: &mut AllFacts,
|
||||
body: &Body<'tcx>,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
borrow_set: &BorrowSet<'tcx>,
|
||||
) {
|
||||
let dominators = body.basic_blocks.dominators();
|
||||
@ -37,7 +37,7 @@ struct LoanInvalidationsGenerator<'a, 'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
facts: &'a mut AllFacts,
|
||||
body: &'a Body<'tcx>,
|
||||
location_table: &'a LocationTable,
|
||||
location_table: &'a PoloniusLocationTable,
|
||||
dominators: &'a Dominators<BasicBlock>,
|
||||
borrow_set: &'a BorrowSet<'tcx>,
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use rustc_middle::mir::{
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use tracing::debug;
|
||||
|
||||
use super::{AllFacts, LocationTable};
|
||||
use super::{AllFacts, PoloniusLocationTable};
|
||||
use crate::borrow_set::BorrowSet;
|
||||
use crate::places_conflict;
|
||||
|
||||
@ -15,7 +15,7 @@ pub(super) fn emit_loan_kills<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
facts: &mut AllFacts,
|
||||
body: &Body<'tcx>,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
borrow_set: &BorrowSet<'tcx>,
|
||||
) {
|
||||
let mut visitor = LoanKillsGenerator { borrow_set, tcx, location_table, facts, body };
|
||||
@ -27,7 +27,7 @@ pub(super) fn emit_loan_kills<'tcx>(
|
||||
struct LoanKillsGenerator<'a, 'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
facts: &'a mut AllFacts,
|
||||
location_table: &'a LocationTable,
|
||||
location_table: &'a PoloniusLocationTable,
|
||||
borrow_set: &'a BorrowSet<'tcx>,
|
||||
body: &'a Body<'tcx>,
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use tracing::debug;
|
||||
/// granularity through outlives relations; however, the rich location
|
||||
/// table serves another purpose: it compresses locations from
|
||||
/// multiple words into a single u32.
|
||||
pub struct LocationTable {
|
||||
pub struct PoloniusLocationTable {
|
||||
num_points: usize,
|
||||
statements_before_block: IndexVec<BasicBlock, usize>,
|
||||
}
|
||||
@ -30,7 +30,7 @@ pub enum RichLocation {
|
||||
Mid(Location),
|
||||
}
|
||||
|
||||
impl LocationTable {
|
||||
impl PoloniusLocationTable {
|
||||
pub(crate) fn new(body: &Body<'_>) -> Self {
|
||||
let mut num_points = 0;
|
||||
let statements_before_block = body
|
||||
@ -43,8 +43,8 @@ impl LocationTable {
|
||||
})
|
||||
.collect();
|
||||
|
||||
debug!("LocationTable(statements_before_block={:#?})", statements_before_block);
|
||||
debug!("LocationTable: num_points={:#?}", num_points);
|
||||
debug!("PoloniusLocationTable(statements_before_block={:#?})", statements_before_block);
|
||||
debug!("PoloniusLocationTable: num_points={:#?}", num_points);
|
||||
|
||||
Self { num_points, statements_before_block }
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ pub use self::facts::*;
|
||||
pub(crate) fn emit_facts<'tcx>(
|
||||
all_facts: &mut Option<AllFacts>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
body: &Body<'tcx>,
|
||||
borrow_set: &BorrowSet<'tcx>,
|
||||
move_data: &MoveData<'tcx>,
|
||||
@ -69,7 +69,7 @@ pub(crate) fn emit_facts<'tcx>(
|
||||
fn emit_move_facts(
|
||||
facts: &mut AllFacts,
|
||||
body: &Body<'_>,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
move_data: &MoveData<'_>,
|
||||
) {
|
||||
facts.path_is_var.extend(move_data.rev_lookup.iter_locals_enumerated().map(|(l, r)| (r, l)));
|
||||
@ -202,7 +202,7 @@ pub(crate) fn emit_drop_facts<'tcx>(
|
||||
/// closure.
|
||||
fn emit_outlives_facts<'tcx>(
|
||||
facts: &mut AllFacts,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
constraints: &MirTypeckRegionConstraints<'tcx>,
|
||||
) {
|
||||
facts.subset_base.extend(constraints.outlives_constraints.outlives().iter().flat_map(
|
||||
|
@ -49,7 +49,7 @@ use crate::constraints::{OutlivesConstraint, OutlivesConstraintSet};
|
||||
use crate::diagnostics::UniverseInfo;
|
||||
use crate::member_constraints::MemberConstraintSet;
|
||||
use crate::polonius::PoloniusContext;
|
||||
use crate::polonius::legacy::{AllFacts, LocationTable};
|
||||
use crate::polonius::legacy::{AllFacts, PoloniusLocationTable};
|
||||
use crate::region_infer::TypeTest;
|
||||
use crate::region_infer::values::{LivenessValues, PlaceholderIndex, PlaceholderIndices};
|
||||
use crate::renumber::RegionCtxt;
|
||||
@ -98,7 +98,7 @@ mod relate_tys;
|
||||
/// - `body` -- MIR body to type-check
|
||||
/// - `promoted` -- map of promoted constants within `body`
|
||||
/// - `universal_regions` -- the universal regions from `body`s function signature
|
||||
/// - `location_table` -- MIR location map of `body`
|
||||
/// - `location_table` -- for datalog polonius, the map between `Location`s and `RichLocation`s
|
||||
/// - `borrow_set` -- information about borrows occurring in `body`
|
||||
/// - `all_facts` -- when using Polonius, this is the generated set of Polonius facts
|
||||
/// - `flow_inits` -- results of a maybe-init dataflow analysis
|
||||
@ -109,7 +109,7 @@ pub(crate) fn type_check<'a, 'tcx>(
|
||||
body: &Body<'tcx>,
|
||||
promoted: &IndexSlice<Promoted, Body<'tcx>>,
|
||||
universal_regions: UniversalRegions<'tcx>,
|
||||
location_table: &LocationTable,
|
||||
location_table: &PoloniusLocationTable,
|
||||
borrow_set: &BorrowSet<'tcx>,
|
||||
all_facts: &mut Option<AllFacts>,
|
||||
flow_inits: ResultsCursor<'a, 'tcx, MaybeInitializedPlaces<'a, 'tcx>>,
|
||||
@ -560,7 +560,7 @@ struct TypeChecker<'a, 'tcx> {
|
||||
implicit_region_bound: ty::Region<'tcx>,
|
||||
reported_errors: FxIndexSet<(Ty<'tcx>, Span)>,
|
||||
universal_regions: &'a UniversalRegions<'tcx>,
|
||||
location_table: &'a LocationTable,
|
||||
location_table: &'a PoloniusLocationTable,
|
||||
all_facts: &'a mut Option<AllFacts>,
|
||||
borrow_set: &'a BorrowSet<'tcx>,
|
||||
constraints: &'a mut MirTypeckRegionConstraints<'tcx>,
|
||||
|
Loading…
Reference in New Issue
Block a user