Skip to content

Commit 6cd1017

Browse files
committed
Revert rust-version increasing rewrite
1 parent c5e164f commit 6cd1017

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

static-alloc/src/unsync/bump.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,10 @@ impl MemBump {
251251
/// This is how many *bytes* can be allocated
252252
/// within this node.
253253
pub const fn capacity(&self) -> usize {
254-
self.data.get().len()
254+
// 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() }
255258
}
256259

257260
/// Get a raw pointer to the data.

0 commit comments

Comments
 (0)