Skip to content

Commit 2b069d9

Browse files
remove skip child logic
1 parent d892cdf commit 2b069d9

File tree

5 files changed

+4
-241
lines changed

5 files changed

+4
-241
lines changed

src/borrow_tracker/tree_borrows/tree.rs

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,24 +1129,6 @@ impl Tree {
11291129
}
11301130

11311131
impl<'tcx> LocationTree {
1132-
/// Returns the smallest exposed tag, if any, that is a transitive child of `root`.
1133-
fn get_min_exposed_child(root: UniIndex, nodes: &UniValMap<Node>) -> Option<BorTag> {
1134-
let mut stack = vec![root];
1135-
let mut min_tag = None;
1136-
while let Some(idx) = stack.pop() {
1137-
let node = nodes.get(idx).unwrap();
1138-
stack.extend_from_slice(node.children.as_slice());
1139-
1140-
if node.is_exposed {
1141-
min_tag = match min_tag {
1142-
Some(prev) if prev < node.tag => Some(prev),
1143-
_ => Some(node.tag),
1144-
};
1145-
}
1146-
}
1147-
min_tag
1148-
}
1149-
11501132
/// Performs an access on this location.
11511133
/// * `access_source`: The index, if any, where the access came from.
11521134
/// * `visit_children`: Whether to skip updating the children of `access_source`.
@@ -1185,26 +1167,11 @@ impl<'tcx> LocationTree {
11851167
};
11861168

11871169
let accessed_root_tag = accessed_root.map(|idx| nodes.get(idx).unwrap().tag);
1188-
// On a protector release access we skip the children of the accessed tag so that
1189-
// we can correctly return references from functions. However, if the tag has
1190-
// exposed children then some of the wildcard subtrees could also be children of
1191-
// the accessed node and would also need to be skipped. We can narrow down which
1192-
// child trees are children by comparing their root tag to the minimum exposed
1193-
// child of the accessed node. As the parent tag is always smaller than the child
1194-
// tag this means we only need to skip subtrees with a root tag larger than
1195-
// `min_exposed_child`.
1196-
let min_exposed_child = match visit_children {
1197-
ChildrenVisitMode::SkipChildrenOfAccessed =>
1198-
Self::get_min_exposed_child(access_source.unwrap(), nodes),
1199-
_ => None,
1200-
};
1170+
if matches!(visit_children, ChildrenVisitMode::SkipChildrenOfAccessed) {
1171+
// FIXME: approximate which roots could be children of the accessed node and only skip them instead of all other trees.
1172+
return interp_ok(());
1173+
}
12011174
for root in roots {
1202-
let tag = nodes.get(root).unwrap().tag;
1203-
if let Some(min_exposed_child) = min_exposed_child {
1204-
if tag > min_exposed_child {
1205-
break;
1206-
}
1207-
}
12081175
// We don't perform a wildcard access on the tree we already performed a
12091176
// normal access on.
12101177
if Some(root) == accessed_root {

tests/fail/tree_borrows/wildcard/protector_release.rs

Lines changed: 0 additions & 77 deletions
This file was deleted.

tests/fail/tree_borrows/wildcard/protector_release.stderr

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/fail/tree_borrows/wildcard/protector_release2.rs

Lines changed: 0 additions & 77 deletions
This file was deleted.

tests/fail/tree_borrows/wildcard/protector_release2.stderr

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)