Try fix stuff

This commit is contained in:
carbotaniuman 2022-06-15 20:55:54 -05:00 committed by Ralf Jung
parent c7feb014b0
commit d1e7de117c
2 changed files with 8 additions and 21 deletions

View File

@ -543,16 +543,9 @@ impl<'tcx> Stack {
// Now we figure out which item grants our parent (`derived_from`) this kind of access.
// We use that to determine where to put the new item.
let granting_idx =
self.find_granting(access, derived_from, exposed_tags).map_err(|_| {
alloc_history.grant_error(
derived_from,
new,
alloc_id,
alloc_range,
offset,
self,
)
})?;
self.find_granting(access, derived_from, exposed_tags).map_err(|_| {
alloc_history.grant_error(derived_from, new, alloc_id, alloc_range, offset, self)
})?;
// Compute where to put the new item.
// Either way, we ensure that we insert the new item in a way such that between
@ -595,7 +588,9 @@ impl<'tcx> Stack {
self.borrows.len()
};
// Put the new item there. As an optimization, deduplicate if it is equal to one of its new neighbors.
if self.borrows.get(new_idx) == Some(&new) || new_idx > 0 && self.borrows.get(new_idx - 1) == Some(&new) {
if self.borrows.get(new_idx) == Some(&new)
|| new_idx > 0 && self.borrows.get(new_idx - 1) == Some(&new)
{
// Optimization applies, done.
trace!("reborrow: avoiding adding redundant item {:?}", new);
} else {

View File

@ -208,11 +208,7 @@ impl AllocHistory {
) -> InterpError<'tcx> {
// TODO: Fix this properly
let z = &derived_from;
let f = if let Some(ref t) = z {
t as &dyn Debug
} else {
&"<wildcard>" as &dyn Debug
};
let f = if let Some(ref t) = z { t as &dyn Debug } else { &"<wildcard>" as &dyn Debug };
let action = format!(
"trying to reborrow {:?} for {:?} permission at {}[{:#x}]",
f,
@ -240,11 +236,7 @@ impl AllocHistory {
stack: &Stack,
) -> InterpError<'tcx> {
let z = &tag;
let f = if let Some(ref t) = z {
t as &dyn Debug
} else {
&"<wildcard>" as &dyn Debug
};
let f = if let Some(ref t) = z { t as &dyn Debug } else { &"<wildcard>" as &dyn Debug };
let action = format!(
"attempting a {} using {:?} at {}[{:#x}]",
access,