Skip to content

Commit d5b2655

Browse files
committed
move checking ptr tracking on item pop into cold helper function
1 parent 709e29a commit d5b2655

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/stacked_borrows.rs

+16-5
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,22 @@ impl<'tcx> Stack {
326326
global: &GlobalStateInner,
327327
alloc_history: &mut AllocHistory,
328328
) -> InterpResult<'tcx> {
329-
if global.tracked_pointer_tags.contains(&item.tag) {
330-
register_diagnostic(NonHaltingDiagnostic::PoppedPointerTag(
331-
*item,
332-
provoking_access.map(|(tag, _alloc_range, _size, access)| (tag, access)),
333-
));
329+
if !global.tracked_pointer_tags.is_empty() {
330+
check_tracked(item, &provoking_access, global);
331+
332+
#[inline(never)] // cold path
333+
fn check_tracked(
334+
item: &Item,
335+
provoking_access: &Option<(SbTagExtra, AllocRange, Size, AccessKind)>,
336+
global: &GlobalStateInner,
337+
) {
338+
if global.tracked_pointer_tags.contains(&item.tag) {
339+
register_diagnostic(NonHaltingDiagnostic::PoppedPointerTag(
340+
*item,
341+
provoking_access.map(|(tag, _alloc_range, _size, access)| (tag, access)),
342+
));
343+
}
344+
}
334345
}
335346

336347
if let Some(call) = item.protector {

0 commit comments

Comments
 (0)