提交 531e4ab7 编写于 作者: B bors

Auto merge of #50798 - bobtwinkles:nll_facts_invalidate, r=nikomatsakis

Generate "invalidates" facts when -Znll-facts is passed

Most of the new code is copied directly from the heart of the MIR borrowchecker. I was expecting more fundamental structural changes, hence the copying. This appears to work as it stands, but I'd like to submit a follow-up PR to reduce code duplication. I figured that could wait though, since this is blocking a large amount of work in the borrow check repository and I'm out of time for tonight =).

r? @nikomatsakis
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
// `region_live_at(R, P)` when the region R appears in a live variable at P // `region_live_at(R, P)` when the region R appears in a live variable at P
crate region_live_at: Vec<(RegionVid, LocationIndex)>, crate region_live_at: Vec<(RegionVid, LocationIndex)>,
// `invalidates(P, B)` when the borrow B is invalidated at point P
crate invalidates: Vec<(LocationIndex, BorrowIndex)>,
} }
impl AllFacts { impl AllFacts {
...@@ -69,6 +72,7 @@ impl AllFacts { ...@@ -69,6 +72,7 @@ impl AllFacts {
killed, killed,
outlives, outlives,
region_live_at, region_live_at,
invalidates,
]) ])
} }
Ok(()) Ok(())
......
此差异已折叠。
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
mod subtype_constraint_generation; mod subtype_constraint_generation;
crate mod type_check; crate mod type_check;
mod universal_regions; mod universal_regions;
mod invalidation;
use self::facts::AllFacts; use self::facts::AllFacts;
use self::region_infer::RegionInferenceContext; use self::region_infer::RegionInferenceContext;
...@@ -130,6 +131,14 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>( ...@@ -130,6 +131,14 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
&mir, &mir,
borrow_set, borrow_set,
); );
invalidation::generate_invalidates(
infcx,
&mut all_facts,
location_table,
&mir,
def_id,
borrow_set
);
// Dump facts if requested. // Dump facts if requested.
if let Some(all_facts) = all_facts { if let Some(all_facts) = all_facts {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册