Skip to content

Commit

Permalink
Fix can_deinit check
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasAlaif committed Sep 28, 2023
1 parent 878b7da commit 62f8e62
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion mir-state-analysis/src/utils/repacker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,19 @@ impl<'tcx> Place<'tcx> {
}

pub fn can_deinit(self, repacker: PlaceRepacker<'_, 'tcx>) -> bool {
!self.projects_shared_ref(repacker)
let mut projects_shared_ref = false;
self.projects_ty(
|typ| {
projects_shared_ref = projects_shared_ref || typ.ty
.ref_mutability()
.map(|m| m.is_not())
.unwrap_or_default();
projects_shared_ref = projects_shared_ref && !typ.ty.is_unsafe_ptr();
false
},
repacker,
);
!projects_shared_ref
}

pub fn projects_ty(
Expand Down

0 comments on commit 62f8e62

Please sign in to comment.