From 63e4bd2b9a4654c151bb4ac8f2fe2b5db726e98b Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 11 Jul 2024 10:11:09 -0700 Subject: [PATCH] Resolve dead_code and unused_variables warnings Summary: Rust 1.79's dead code scanner is more precise than previous versions. `pub` is no longer sufficient to hide a data structure field from the lint. It actually looks at whether an unused pub field is reachable from outside the crate. In the following example, the field `field` is considered dead code by Rust 1.79 and not by 1.78. ```lang=rust mod module { pub struct Struct { pub field: i32, } impl Struct { pub fn new() -> Self { Struct { field: 0 } } } } pub fn repro() { let _ = Struct::new(); } ``` Reviewed By: zertosh, JakobDegen Differential Revision: D59623034 fbshipit-source-id: 6a4e2fb6e5be410d5127b451704df74ecdd42bf0 --- detcore/src/scheduler.rs | 6 ++++++ hermit-verify/src/common/env.rs | 1 + 2 files changed, 7 insertions(+) diff --git a/detcore/src/scheduler.rs b/detcore/src/scheduler.rs index d328bb1..e99b624 100644 --- a/detcore/src/scheduler.rs +++ b/detcore/src/scheduler.rs @@ -84,12 +84,15 @@ pub type Seconds = u32; #[derive(Debug, Clone)] pub struct Action { /// Id for the action + #[allow(dead_code)] pub action_id: ActionID, /// The action's side effects are completed. + #[allow(dead_code)] pub completion: Ivar<()>, /// Which action gets the lock after me. + #[allow(dead_code)] pub successors: HashMap, } @@ -232,6 +235,7 @@ pub struct Scheduler { pub next_turns: BTreeMap, /// The current set of actions in the background. + #[allow(dead_code)] pub bg_action_pool: HashMap, /// The logical, global time consumed by actions that have been committed already. @@ -242,6 +246,7 @@ pub struct Scheduler { /// Ac table of "locks held": which action is using which resources. /// A given resource can be held by at most one action at a given time. + #[allow(dead_code)] pub resources: HashMap, /// Initially false, set to true when the first thread is running. @@ -726,6 +731,7 @@ pub struct ConsumeResult { /// Should we print the stacktrace in the guest, as per --stacktrace-event pub print_stack: MaybePrintStack, /// The number of this event in the global total order of events. + #[allow(dead_code)] pub event_ix: u64, } diff --git a/hermit-verify/src/common/env.rs b/hermit-verify/src/common/env.rs index b7f7c06..a896314 100644 --- a/hermit-verify/src/common/env.rs +++ b/hermit-verify/src/common/env.rs @@ -199,6 +199,7 @@ impl EnvPath { #[derive(Clone)] pub struct RunEnvironment { // Root directory for one run + #[allow(dead_code)] pub temp_dir: PathBuf, // Path to log file