mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
update polonius-engine to 0.13
and update fact generation to the new relation names
This commit is contained in:
parent
2939249f29
commit
99cc35daef
@ -2618,9 +2618,9 @@ checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33"
|
||||
|
||||
[[package]]
|
||||
name = "polonius-engine"
|
||||
version = "0.12.1"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef2558a4b464e185b36ee08a2937ebb62ea5464c38856cfb1465c97cb38db52d"
|
||||
checksum = "c4e8e505342045d397d0b6674dcb82d6faf5cf40484d30eeb88fc82ef14e903f"
|
||||
dependencies = [
|
||||
"datafrog",
|
||||
"log",
|
||||
|
@ -11,7 +11,7 @@ rustc_arena = { path = "../rustc_arena" }
|
||||
bitflags = "1.2.1"
|
||||
tracing = "0.1"
|
||||
rustc-rayon-core = "0.3.1"
|
||||
polonius-engine = "0.12.0"
|
||||
polonius-engine = "0.13.0"
|
||||
rustc_apfloat = { path = "../rustc_apfloat" }
|
||||
rustc_attr = { path = "../rustc_attr" }
|
||||
rustc_feature = { path = "../rustc_feature" }
|
||||
|
@ -12,7 +12,7 @@ rustc_graphviz = { path = "../rustc_graphviz" }
|
||||
gsgdt = "0.1.2"
|
||||
itertools = "0.9"
|
||||
tracing = "0.1"
|
||||
polonius-engine = "0.12.0"
|
||||
polonius-engine = "0.13.0"
|
||||
regex = "1"
|
||||
rustc_middle = { path = "../rustc_middle" }
|
||||
rustc_attr = { path = "../rustc_attr" }
|
||||
|
@ -224,7 +224,7 @@ impl<'cx, 'cg, 'tcx> ConstraintGeneration<'cx, 'cg, 'tcx> {
|
||||
|
||||
if places_conflict {
|
||||
let location_index = self.location_table.mid_index(location);
|
||||
all_facts.killed.push((borrow_index, location_index));
|
||||
all_facts.loan_killed_at.push((borrow_index, location_index));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -243,10 +243,10 @@ fn record_killed_borrows_for_local(
|
||||
location: Location,
|
||||
) {
|
||||
if let Some(borrow_indices) = borrow_set.local_map.get(&local) {
|
||||
all_facts.killed.reserve(borrow_indices.len());
|
||||
all_facts.loan_killed_at.reserve(borrow_indices.len());
|
||||
for &borrow_index in borrow_indices {
|
||||
let location_index = location_table.mid_index(location);
|
||||
all_facts.killed.push((borrow_index, location_index));
|
||||
all_facts.loan_killed_at.push((borrow_index, location_index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,13 +64,12 @@ impl AllFactsExt for AllFacts {
|
||||
}
|
||||
write_facts_to_path! {
|
||||
wr.write_facts_to_path(self.[
|
||||
borrow_region,
|
||||
loan_issued_at,
|
||||
universal_region,
|
||||
placeholder,
|
||||
cfg_edge,
|
||||
killed,
|
||||
outlives,
|
||||
invalidates,
|
||||
loan_killed_at,
|
||||
subset_base,
|
||||
loan_invalidated_at,
|
||||
var_used_at,
|
||||
var_defined_at,
|
||||
var_dropped_at,
|
||||
@ -81,7 +80,8 @@ impl AllFactsExt for AllFacts {
|
||||
path_assigned_at_base,
|
||||
path_moved_at_base,
|
||||
path_accessed_at_base,
|
||||
known_subset,
|
||||
known_placeholder_subset,
|
||||
placeholder,
|
||||
])
|
||||
}
|
||||
Ok(())
|
||||
|
@ -179,7 +179,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
|
||||
let resume = self.location_table.start_index(resume.start_location());
|
||||
for (i, data) in borrow_set.iter_enumerated() {
|
||||
if borrow_of_local_data(data.borrowed_place) {
|
||||
self.all_facts.invalidates.push((resume, i));
|
||||
self.all_facts.loan_invalidated_at.push((resume, i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
|
||||
let start = self.location_table.start_index(location);
|
||||
for (i, data) in borrow_set.iter_enumerated() {
|
||||
if borrow_of_local_data(data.borrowed_place) {
|
||||
self.all_facts.invalidates.push((start, i));
|
||||
self.all_facts.loan_invalidated_at.push((start, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -420,7 +420,7 @@ impl<'cx, 'tcx> InvalidationGenerator<'cx, 'tcx> {
|
||||
|
||||
// Unique and mutable borrows are invalidated by reads from any
|
||||
// involved path
|
||||
this.generate_invalidates(borrow_index, location);
|
||||
this.emit_loan_invalidated_at(borrow_index, location);
|
||||
}
|
||||
|
||||
(Reservation(_) | Activation(_, _) | Write(_), _) => {
|
||||
@ -428,7 +428,7 @@ impl<'cx, 'tcx> InvalidationGenerator<'cx, 'tcx> {
|
||||
// Reservations count as writes since we need to check
|
||||
// that activating the borrow will be OK
|
||||
// FIXME(bob_twinkles) is this actually the right thing to do?
|
||||
this.generate_invalidates(borrow_index, location);
|
||||
this.emit_loan_invalidated_at(borrow_index, location);
|
||||
}
|
||||
}
|
||||
Control::Continue
|
||||
@ -436,10 +436,10 @@ impl<'cx, 'tcx> InvalidationGenerator<'cx, 'tcx> {
|
||||
);
|
||||
}
|
||||
|
||||
/// Generates a new `invalidates(L, B)` fact.
|
||||
fn generate_invalidates(&mut self, b: BorrowIndex, l: Location) {
|
||||
/// Generates a new `loan_invalidated_at(L, B)` fact.
|
||||
fn emit_loan_invalidated_at(&mut self, b: BorrowIndex, l: Location) {
|
||||
let lidx = self.location_table.start_index(l);
|
||||
self.all_facts.invalidates.push((lidx, b));
|
||||
self.all_facts.loan_invalidated_at.push((lidx, b));
|
||||
}
|
||||
|
||||
fn check_activations(&mut self, location: Location) {
|
||||
|
@ -216,14 +216,15 @@ pub(in crate::borrow_check) fn compute_regions<'cx, 'tcx>(
|
||||
}
|
||||
|
||||
// 2: the universal region relations `outlives` constraints are emitted as
|
||||
// `known_subset` facts.
|
||||
// `known_placeholder_subset` facts.
|
||||
for (fr1, fr2) in universal_region_relations.known_outlives() {
|
||||
if fr1 != fr2 {
|
||||
debug!(
|
||||
"compute_regions: emitting polonius `known_subset` fr1={:?}, fr2={:?}",
|
||||
"compute_regions: emitting polonius `known_placeholder_subset` \
|
||||
fr1={:?}, fr2={:?}",
|
||||
fr1, fr2
|
||||
);
|
||||
all_facts.known_subset.push((*fr1, *fr2));
|
||||
all_facts.known_placeholder_subset.push((*fr1, *fr2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ fn translate_outlives_facts(typeck: &mut TypeChecker<'_, '_>) {
|
||||
if let Some(facts) = cx.all_facts {
|
||||
let _prof_timer = typeck.infcx.tcx.prof.generic_activity("polonius_fact_generation");
|
||||
let location_table = cx.location_table;
|
||||
facts.outlives.extend(cx.constraints.outlives_constraints.outlives().iter().flat_map(
|
||||
facts.subset_base.extend(cx.constraints.outlives_constraints.outlives().iter().flat_map(
|
||||
|constraint: &OutlivesConstraint<'_>| {
|
||||
if let Some(from_location) = constraint.locations.from_location() {
|
||||
Either::Left(iter::once((
|
||||
@ -2461,7 +2461,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
let BorrowCheckContext { borrow_set, location_table, all_facts, constraints, .. } =
|
||||
self.borrowck_context;
|
||||
|
||||
// In Polonius mode, we also push a `borrow_region` fact
|
||||
// In Polonius mode, we also push a `loan_issued_at` fact
|
||||
// linking the loan to the region (in some cases, though,
|
||||
// there is no loan associated with this borrow expression --
|
||||
// that occurs when we are borrowing an unsafe place, for
|
||||
@ -2470,7 +2470,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
let _prof_timer = self.infcx.tcx.prof.generic_activity("polonius_fact_generation");
|
||||
if let Some(borrow_index) = borrow_set.get_index_of(&location) {
|
||||
let region_vid = borrow_region.to_region_vid();
|
||||
all_facts.borrow_region.push((
|
||||
all_facts.loan_issued_at.push((
|
||||
region_vid,
|
||||
borrow_index,
|
||||
location_table.mid_index(location),
|
||||
|
Loading…
Reference in New Issue
Block a user