Skip to content

Commit 10aa4aa

Browse files
committed
Fix new compilation warnings in debug_sync module
1 parent b84b53a commit 10aa4aa

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lightning/src/debug_sync.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ struct LockMetadata {
6868

6969
struct LockDep {
7070
lock: Arc<LockMetadata>,
71-
lockdep_trace: Backtrace,
71+
/// lockdep_trace is unused unless we're building with `backtrace`, so we mark it _
72+
_lockdep_trace: Backtrace,
7273
}
7374

7475
#[cfg(feature = "backtrace")]
@@ -140,21 +141,21 @@ impl LockMetadata {
140141
// of the same lock.
141142
debug_assert!(cfg!(feature = "backtrace"), "Tried to acquire a lock while it was held!");
142143
}
143-
for (locked_dep_idx, locked_dep) in locked.locked_before.lock().unwrap().iter() {
144+
for (locked_dep_idx, _locked_dep) in locked.locked_before.lock().unwrap().iter() {
144145
if *locked_dep_idx == this.lock_idx && *locked_dep_idx != locked.lock_idx {
145146
#[cfg(feature = "backtrace")]
146147
panic!("Tried to violate existing lockorder.\nMutex that should be locked after the current lock was created at the following backtrace.\nNote that to get a backtrace for the lockorder violation, you should set RUST_BACKTRACE=1\nLock being taken constructed at: {} ({}):\n{:?}\nLock constructed at: {} ({})\n{:?}\n\nLock dep created at:\n{:?}\n\n",
147148
get_construction_location(&this._lock_construction_bt), this.lock_idx, this._lock_construction_bt,
148149
get_construction_location(&locked._lock_construction_bt), locked.lock_idx, locked._lock_construction_bt,
149-
locked_dep.lockdep_trace);
150+
_locked_dep._lockdep_trace);
150151
#[cfg(not(feature = "backtrace"))]
151152
panic!("Tried to violate existing lockorder. Build with the backtrace feature for more info.");
152153
}
153154
}
154155
// Insert any already-held locks in our locked-before set.
155156
let mut locked_before = this.locked_before.lock().unwrap();
156157
if !locked_before.contains_key(&locked.lock_idx) {
157-
let lockdep = LockDep { lock: Arc::clone(locked), lockdep_trace: Backtrace::new() };
158+
let lockdep = LockDep { lock: Arc::clone(locked), _lockdep_trace: Backtrace::new() };
158159
locked_before.insert(lockdep.lock.lock_idx, lockdep);
159160
}
160161
}
@@ -175,7 +176,7 @@ impl LockMetadata {
175176
let mut locked_before = this.locked_before.lock().unwrap();
176177
for (locked_idx, locked) in held.borrow().iter() {
177178
if !locked_before.contains_key(locked_idx) {
178-
let lockdep = LockDep { lock: Arc::clone(locked), lockdep_trace: Backtrace::new() };
179+
let lockdep = LockDep { lock: Arc::clone(locked), _lockdep_trace: Backtrace::new() };
179180
locked_before.insert(*locked_idx, lockdep);
180181
}
181182
}

0 commit comments

Comments
 (0)