Skip to content

Commit d923c18

Browse files
authored
vulkan,d3d12: Remove unused backtrace field from Allocator (#88)
Only `SubAllocator`s print their backtrace and need to hold on to this field; there is no need for the `Allocator` to hold on to and own the exact same value. Rust 1.57 now detects such unused fields, when they have previously only been used inside `derive()` macros such as `Debug`.
1 parent 672214e commit d923c18

File tree

2 files changed

+0
-10
lines changed

2 files changed

+0
-10
lines changed

src/d3d12/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ pub struct Allocation {
149149
heap: *mut d3d12::ID3D12Heap,
150150

151151
name: Option<Box<str>>,
152-
backtrace: Option<Box<str>>,
153152
}
154153

155154
unsafe impl Send for Allocation {}
@@ -197,7 +196,6 @@ impl Default for Allocation {
197196
memory_type_index: !0,
198197
heap: std::ptr::null_mut(),
199198
name: None,
200-
backtrace: None,
201199
}
202200
}
203201
}
@@ -369,7 +367,6 @@ impl MemoryType {
369367
memory_type_index: self.memory_type_index as usize,
370368
heap: mem_block.heap.as_ptr(),
371369
name: Some(desc.name.into()),
372-
backtrace: backtrace.map(|s| s.into()),
373370
});
374371
}
375372

@@ -395,7 +392,6 @@ impl MemoryType {
395392
memory_type_index: self.memory_type_index as usize,
396393
heap: mem_block.heap.as_ptr(),
397394
name: Some(desc.name.into()),
398-
backtrace: backtrace.map(|s| s.into()),
399395
});
400396
}
401397
Err(AllocationError::OutOfMemory) => {} // Block is full, continue search.
@@ -453,7 +449,6 @@ impl MemoryType {
453449
memory_type_index: self.memory_type_index as usize,
454450
heap: mem_block.heap.as_ptr(),
455451
name: Some(desc.name.into()),
456-
backtrace: backtrace.map(|s| s.into()),
457452
})
458453
}
459454

src/vulkan/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub struct Allocation {
4444
mapped_ptr: Option<std::ptr::NonNull<std::ffi::c_void>>,
4545

4646
name: Option<Box<str>>,
47-
backtrace: Option<Box<str>>,
4847
}
4948

5049
// Sending is fine because mapped_ptr does not change based on the thread we are in
@@ -121,7 +120,6 @@ impl Default for Allocation {
121120
device_memory: vk::DeviceMemory::null(),
122121
mapped_ptr: None,
123122
name: None,
124-
backtrace: None,
125123
}
126124
}
127125
}
@@ -298,7 +296,6 @@ impl MemoryType {
298296
device_memory: mem_block.device_memory,
299297
mapped_ptr: std::ptr::NonNull::new(mem_block.mapped_ptr),
300298
name: Some(desc.name.into()),
301-
backtrace: backtrace.map(|s| s.into()),
302299
});
303300
}
304301

@@ -331,7 +328,6 @@ impl MemoryType {
331328
device_memory: mem_block.device_memory,
332329
mapped_ptr,
333330
name: Some(desc.name.into()),
334-
backtrace: backtrace.map(|s| s.into()),
335331
});
336332
}
337333
Err(err) => match err {
@@ -403,7 +399,6 @@ impl MemoryType {
403399
device_memory: mem_block.device_memory,
404400
mapped_ptr,
405401
name: Some(desc.name.into()),
406-
backtrace: backtrace.map(|s| s.into()),
407402
})
408403
}
409404

0 commit comments

Comments
 (0)