fix return value of Pool::grow on x86_64

the logic was increasing the "capacity" counter even in the case the given memory address was out of
range (ANCHOR +- 2GB) -- `None` branch in code -- resulting in a wrong / misleading value being
reported
This commit is contained in:
Jorge Aparicio 2021-08-25 15:13:07 +02:00
parent f49f967148
commit 0d721bf0e6

View File

@ -359,15 +359,16 @@ impl<T> Pool<T> {
() => {
if let Some(p) = Ptr::new(p as *mut _) {
self.stack.push(p);
n += 1;
}
}
#[cfg(not(target_arch = "x86_64"))]
() => {
self.stack.push(unsafe { Ptr::new_unchecked(p as *mut _) });
n += 1;
}
}
n += 1;
p = unsafe { p.add(sz) };
len -= sz;