We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c5e164f commit 6cd1017Copy full SHA for 6cd1017
static-alloc/src/unsync/bump.rs
@@ -251,7 +251,10 @@ impl MemBump {
251
/// This is how many *bytes* can be allocated
252
/// within this node.
253
pub const fn capacity(&self) -> usize {
254
- self.data.get().len()
+ // Safety: just gets the pointer metadata `len` without invalidating any provenance,
255
+ // accepting the pointer use itself. This may be replaced by a safe `pointer::len` as soon
256
+ // as stable (#71146) and const which would avoid any pointer use.
257
+ unsafe { (*(self.data.get() as *const [UnsafeCell<u8>])).len() }
258
}
259
260
/// Get a raw pointer to the data.
0 commit comments