Skip to content

Commit

Permalink
Disable tree traversal optimization that is wrong due to lazy nodes.
Browse files Browse the repository at this point in the history
See rust-lang#3846 for more information.
  • Loading branch information
JoJoDeveloping committed Aug 26, 2024
1 parent 2f13379 commit 25e5ac4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ impl LocationState {
// the propagation can be skipped next time.
// It is a performance loss not to call this function when a foreign access occurs.
// It is unsound not to call this function when a child access occurs.
fn skip_if_known_noop(
// FIXME: This optimization is wrong, and is currently disabled (by ignoring the
// result returned here). Since we presumably want an optimization like this,
// we should add it back. See #3864 for more information.
fn update_last_foreign_access(
&mut self,
access_kind: AccessKind,
rel_pos: AccessRelatedness,
Expand Down Expand Up @@ -613,10 +616,7 @@ impl<'tcx> Tree {

let old_state = perm.or_insert(LocationState::new_uninit(node.default_initial_perm));

match old_state.skip_if_known_noop(access_kind, rel_pos) {
ContinueTraversal::SkipChildren => return Ok(ContinueTraversal::SkipChildren),
_ => {}
}
old_state.update_last_foreign_access(access_kind, rel_pos);

let protected = global.borrow().protected_tags.contains_key(&node.tag);
let transition = old_state.perform_access(access_kind, rel_pos, protected)?;
Expand Down

0 comments on commit 25e5ac4

Please sign in to comment.