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