Skip to content

Commit 99cc35d

Browse files
committed
update polonius-engine to 0.13
and update fact generation to the new relation names
1 parent 2939249 commit 99cc35d

File tree

8 files changed

+27
-26
lines changed

8 files changed

+27
-26
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2618,9 +2618,9 @@ checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33"
26182618

26192619
[[package]]
26202620
name = "polonius-engine"
2621-
version = "0.12.1"
2621+
version = "0.13.0"
26222622
source = "registry+https://github.com/rust-lang/crates.io-index"
2623-
checksum = "ef2558a4b464e185b36ee08a2937ebb62ea5464c38856cfb1465c97cb38db52d"
2623+
checksum = "c4e8e505342045d397d0b6674dcb82d6faf5cf40484d30eeb88fc82ef14e903f"
26242624
dependencies = [
26252625
"datafrog",
26262626
"log",

compiler/rustc_middle/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rustc_arena = { path = "../rustc_arena" }
1111
bitflags = "1.2.1"
1212
tracing = "0.1"
1313
rustc-rayon-core = "0.3.1"
14-
polonius-engine = "0.12.0"
14+
polonius-engine = "0.13.0"
1515
rustc_apfloat = { path = "../rustc_apfloat" }
1616
rustc_attr = { path = "../rustc_attr" }
1717
rustc_feature = { path = "../rustc_feature" }

compiler/rustc_mir/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ rustc_graphviz = { path = "../rustc_graphviz" }
1212
gsgdt = "0.1.2"
1313
itertools = "0.9"
1414
tracing = "0.1"
15-
polonius-engine = "0.12.0"
15+
polonius-engine = "0.13.0"
1616
regex = "1"
1717
rustc_middle = { path = "../rustc_middle" }
1818
rustc_attr = { path = "../rustc_attr" }

compiler/rustc_mir/src/borrow_check/constraint_generation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ impl<'cx, 'cg, 'tcx> ConstraintGeneration<'cx, 'cg, 'tcx> {
224224

225225
if places_conflict {
226226
let location_index = self.location_table.mid_index(location);
227-
all_facts.killed.push((borrow_index, location_index));
227+
all_facts.loan_killed_at.push((borrow_index, location_index));
228228
}
229229
}
230230
}
@@ -243,10 +243,10 @@ fn record_killed_borrows_for_local(
243243
location: Location,
244244
) {
245245
if let Some(borrow_indices) = borrow_set.local_map.get(&local) {
246-
all_facts.killed.reserve(borrow_indices.len());
246+
all_facts.loan_killed_at.reserve(borrow_indices.len());
247247
for &borrow_index in borrow_indices {
248248
let location_index = location_table.mid_index(location);
249-
all_facts.killed.push((borrow_index, location_index));
249+
all_facts.loan_killed_at.push((borrow_index, location_index));
250250
}
251251
}
252252
}

compiler/rustc_mir/src/borrow_check/facts.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,12 @@ impl AllFactsExt for AllFacts {
6464
}
6565
write_facts_to_path! {
6666
wr.write_facts_to_path(self.[
67-
borrow_region,
67+
loan_issued_at,
6868
universal_region,
69-
placeholder,
7069
cfg_edge,
71-
killed,
72-
outlives,
73-
invalidates,
70+
loan_killed_at,
71+
subset_base,
72+
loan_invalidated_at,
7473
var_used_at,
7574
var_defined_at,
7675
var_dropped_at,
@@ -81,7 +80,8 @@ impl AllFactsExt for AllFacts {
8180
path_assigned_at_base,
8281
path_moved_at_base,
8382
path_accessed_at_base,
84-
known_subset,
83+
known_placeholder_subset,
84+
placeholder,
8585
])
8686
}
8787
Ok(())

compiler/rustc_mir/src/borrow_check/invalidation.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
179179
let resume = self.location_table.start_index(resume.start_location());
180180
for (i, data) in borrow_set.iter_enumerated() {
181181
if borrow_of_local_data(data.borrowed_place) {
182-
self.all_facts.invalidates.push((resume, i));
182+
self.all_facts.loan_invalidated_at.push((resume, i));
183183
}
184184
}
185185

@@ -191,7 +191,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
191191
let start = self.location_table.start_index(location);
192192
for (i, data) in borrow_set.iter_enumerated() {
193193
if borrow_of_local_data(data.borrowed_place) {
194-
self.all_facts.invalidates.push((start, i));
194+
self.all_facts.loan_invalidated_at.push((start, i));
195195
}
196196
}
197197
}
@@ -420,26 +420,26 @@ impl<'cx, 'tcx> InvalidationGenerator<'cx, 'tcx> {
420420

421421
// Unique and mutable borrows are invalidated by reads from any
422422
// involved path
423-
this.generate_invalidates(borrow_index, location);
423+
this.emit_loan_invalidated_at(borrow_index, location);
424424
}
425425

426426
(Reservation(_) | Activation(_, _) | Write(_), _) => {
427427
// unique or mutable borrows are invalidated by writes.
428428
// Reservations count as writes since we need to check
429429
// that activating the borrow will be OK
430430
// FIXME(bob_twinkles) is this actually the right thing to do?
431-
this.generate_invalidates(borrow_index, location);
431+
this.emit_loan_invalidated_at(borrow_index, location);
432432
}
433433
}
434434
Control::Continue
435435
},
436436
);
437437
}
438438

439-
/// Generates a new `invalidates(L, B)` fact.
440-
fn generate_invalidates(&mut self, b: BorrowIndex, l: Location) {
439+
/// Generates a new `loan_invalidated_at(L, B)` fact.
440+
fn emit_loan_invalidated_at(&mut self, b: BorrowIndex, l: Location) {
441441
let lidx = self.location_table.start_index(l);
442-
self.all_facts.invalidates.push((lidx, b));
442+
self.all_facts.loan_invalidated_at.push((lidx, b));
443443
}
444444

445445
fn check_activations(&mut self, location: Location) {

compiler/rustc_mir/src/borrow_check/nll.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,15 @@ pub(in crate::borrow_check) fn compute_regions<'cx, 'tcx>(
216216
}
217217

218218
// 2: the universal region relations `outlives` constraints are emitted as
219-
// `known_subset` facts.
219+
// `known_placeholder_subset` facts.
220220
for (fr1, fr2) in universal_region_relations.known_outlives() {
221221
if fr1 != fr2 {
222222
debug!(
223-
"compute_regions: emitting polonius `known_subset` fr1={:?}, fr2={:?}",
223+
"compute_regions: emitting polonius `known_placeholder_subset` \
224+
fr1={:?}, fr2={:?}",
224225
fr1, fr2
225226
);
226-
all_facts.known_subset.push((*fr1, *fr2));
227+
all_facts.known_placeholder_subset.push((*fr1, *fr2));
227228
}
228229
}
229230
}

compiler/rustc_mir/src/borrow_check/type_check/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ fn translate_outlives_facts(typeck: &mut TypeChecker<'_, '_>) {
272272
if let Some(facts) = cx.all_facts {
273273
let _prof_timer = typeck.infcx.tcx.prof.generic_activity("polonius_fact_generation");
274274
let location_table = cx.location_table;
275-
facts.outlives.extend(cx.constraints.outlives_constraints.outlives().iter().flat_map(
275+
facts.subset_base.extend(cx.constraints.outlives_constraints.outlives().iter().flat_map(
276276
|constraint: &OutlivesConstraint<'_>| {
277277
if let Some(from_location) = constraint.locations.from_location() {
278278
Either::Left(iter::once((
@@ -2461,7 +2461,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
24612461
let BorrowCheckContext { borrow_set, location_table, all_facts, constraints, .. } =
24622462
self.borrowck_context;
24632463

2464-
// In Polonius mode, we also push a `borrow_region` fact
2464+
// In Polonius mode, we also push a `loan_issued_at` fact
24652465
// linking the loan to the region (in some cases, though,
24662466
// there is no loan associated with this borrow expression --
24672467
// that occurs when we are borrowing an unsafe place, for
@@ -2470,7 +2470,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
24702470
let _prof_timer = self.infcx.tcx.prof.generic_activity("polonius_fact_generation");
24712471
if let Some(borrow_index) = borrow_set.get_index_of(&location) {
24722472
let region_vid = borrow_region.to_region_vid();
2473-
all_facts.borrow_region.push((
2473+
all_facts.loan_issued_at.push((
24742474
region_vid,
24752475
borrow_index,
24762476
location_table.mid_index(location),

0 commit comments

Comments
 (0)