mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Small fixes in thread local code.
This commit is contained in:
parent
c68c384b88
commit
3b9e214c40
@ -630,7 +630,7 @@ impl<T: 'static> LocalKey<RefCell<T>> {
|
||||
where
|
||||
F: FnOnce(&T) -> R,
|
||||
{
|
||||
self.with(|cell| f(&mut cell.borrow()))
|
||||
self.with(|cell| f(&cell.borrow()))
|
||||
}
|
||||
|
||||
/// Acquires a mutable reference to the contained value.
|
||||
@ -703,7 +703,7 @@ impl<T: 'static> LocalKey<RefCell<T>> {
|
||||
// The cell was already initialized, so `value` wasn't used to
|
||||
// initialize it. So we overwrite the current value with the
|
||||
// new one instead.
|
||||
cell.replace(init.into_inner());
|
||||
*cell.borrow_mut() = value.into_inner();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user