A bit of cleanup

This commit is contained in:
Ben Kimock 2022-09-26 16:07:32 -04:00 committed by Ralf Jung
parent 25e8f8eddf
commit a7153b5505
5 changed files with 28 additions and 8 deletions

View File

@ -183,7 +183,8 @@ impl<'mir, 'tcx> Thread<'mir, 'tcx> {
impl VisitMachineValues for Thread<'_, '_> {
fn visit_machine_values(&self, visit: &mut impl FnMut(&Operand<Provenance>)) {
let Thread { panic_payload, last_error, stack, .. } = self;
let Thread { panic_payload, last_error, stack, state: _, thread_name: _, join_status: _ } =
self;
if let Some(payload) = panic_payload {
visit(&Operand::Immediate(Immediate::Scalar(*payload)))
@ -199,7 +200,16 @@ impl VisitMachineValues for Thread<'_, '_> {
impl VisitMachineValues for Frame<'_, '_, Provenance, FrameData<'_>> {
fn visit_machine_values(&self, visit: &mut impl FnMut(&Operand<Provenance>)) {
let Frame { return_place, locals, extra, .. } = self;
let Frame {
return_place,
locals,
extra,
body: _,
instance: _,
return_to_block: _,
loc: _,
..
} = self;
// Return place.
if let Place::Ptr(mplace) = **return_place {
@ -290,7 +300,14 @@ impl<'mir, 'tcx> Default for ThreadManager<'mir, 'tcx> {
impl VisitMachineValues for ThreadManager<'_, '_> {
fn visit_machine_values(&self, visit: &mut impl FnMut(&Operand<Provenance>)) {
let ThreadManager { threads, thread_local_alloc_ids, .. } = self;
let ThreadManager {
threads,
thread_local_alloc_ids,
active_thread: _,
yield_active_thread: _,
sync: _,
timeout_callbacks: _,
} = self;
for thread in threads {
thread.visit_machine_values(visit);

View File

@ -65,7 +65,7 @@ impl<'tcx> std::fmt::Debug for FrameData<'tcx> {
impl VisitMachineValues for FrameData<'_> {
fn visit_machine_values(&self, visit: &mut impl FnMut(&Operand<Provenance>)) {
let FrameData { catch_unwind, .. } = self;
let FrameData { catch_unwind, stacked_borrows: _, timing: _ } = self;
if let Some(catch_unwind) = catch_unwind {
catch_unwind.visit_machine_values(visit);

View File

@ -37,8 +37,9 @@ pub struct CatchUnwindData<'tcx> {
impl VisitMachineValues for CatchUnwindData<'_> {
fn visit_machine_values(&self, visit: &mut impl FnMut(&Operand<Provenance>)) {
visit(&Operand::Indirect(MemPlace::from_ptr(self.catch_fn)));
visit(&Operand::Immediate(Immediate::Scalar(self.data)));
let CatchUnwindData { catch_fn, data, dest: _, ret: _ } = self;
visit(&Operand::Indirect(MemPlace::from_ptr(*catch_fn)));
visit(&Operand::Immediate(Immediate::Scalar(*data)));
}
}

View File

@ -464,7 +464,9 @@ impl Default for DirHandler {
impl VisitMachineValues for DirHandler {
fn visit_machine_values(&self, visit: &mut impl FnMut(&Operand<Provenance>)) {
for dir in self.streams.values() {
let DirHandler { streams, next_id: _ } = self;
for dir in streams.values() {
visit(&Operand::Indirect(MemPlace::from_ptr(dir.entry)));
}
}

View File

@ -46,7 +46,7 @@ impl Stack {
// For stacks with a known bottom, we never consider removing the bottom-most tag, because
// that is the base tag which exists whether or not there are any pointers to the
// allocation.
let mut read_idx = usize::from(self.unknown_bottom.is_none());
let mut read_idx = if self.unknown_bottom.is_some() { 0 } else { 1 };
let mut write_idx = read_idx;
while read_idx < self.borrows.len() {
let left = self.borrows[read_idx - 1];