Fix unsoundness in Forever
This commit is contained in:
parent
2e062f5627
commit
49d5121094
1 changed files with 2 additions and 2 deletions
|
@ -18,7 +18,7 @@ impl<T> Forever<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn put(&self, val: T) -> &'static mut T {
|
||||
pub fn put(&'static self, val: T) -> &'static mut T {
|
||||
if self.used.compare_and_swap(false, true, Ordering::SeqCst) {
|
||||
panic!("Forever.put() called multiple times");
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ impl<T> Forever<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub unsafe fn steal(&self) -> &'static mut T {
|
||||
pub unsafe fn steal(&'static self) -> &'static mut T {
|
||||
let p = self.t.get();
|
||||
let p = (&mut *p).as_mut_ptr();
|
||||
&mut *p
|
||||
|
|
Loading…
Reference in a new issue