]> git.lizzy.rs Git - rust.git/commitdiff
A bit of cleanup
authorBen Kimock <kimockb@gmail.com>
Mon, 26 Sep 2022 20:07:32 +0000 (16:07 -0400)
committerRalf Jung <post@ralfj.de>
Tue, 4 Oct 2022 13:32:10 +0000 (15:32 +0200)
src/tools/miri/src/concurrency/thread.rs
src/tools/miri/src/machine.rs
src/tools/miri/src/shims/panic.rs
src/tools/miri/src/shims/unix/fs.rs
src/tools/miri/src/stacked_borrows/stack.rs

index 7b91f8c223ab6ca2aabb97733a37c25f6aa8a64b..1b05088b3d54eb42279b6d2624fc312654c45dcc 100644 (file)
@@ -183,7 +183,8 @@ fn new(name: &str) -> Self {
 
 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 @@ fn visit_machine_values(&self, visit: &mut impl FnMut(&Operand<Provenance>)) {
 
 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 @@ fn default() -> Self {
 
 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);
index 6a06df2a16b342ff24471ede30f91b88d1b135ee..35d5c0d9a8744dc5125d2e926d929c0f73fc8628 100644 (file)
@@ -65,7 +65,7 @@ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
 
 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);
index dd6e2d53b4e8c2fe57fc23cbaac0514959aba699..be14892f69681857b8479ea71374ecd778155170 100644 (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)));
     }
 }
 
index 576e12d34757f1852b0ddac6dd3cdf0ccebfe57b..59d24e00dc1aea1afac3b4246f0a6967c0aa8eba 100644 (file)
@@ -464,7 +464,9 @@ fn default() -> 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)));
         }
     }
index eb30f023935b9dbaff4c3d871f4a1aee529a8f00..57de1c21c8b2de57a0feb284c5bee0457442873b 100644 (file)
@@ -46,7 +46,7 @@ pub fn retain(&mut self, tags: &FxHashSet<SbTag>) {
         // 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];