mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-23 02:27:39 +03:00
IMO better borrow_mut() documentation on RefCell
Previous borrow() is enough to make borrow_mut() panic, no need to have borrow_mut() twice. [This](http://is.gd/woKKAW)
This commit is contained in:
+1
-1
@@ -417,7 +417,7 @@ pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
|
||||
///
|
||||
/// let result = thread::spawn(move || {
|
||||
/// let c = RefCell::new(5);
|
||||
/// let m = c.borrow_mut();
|
||||
/// let m = c.borrow();
|
||||
///
|
||||
/// let b = c.borrow_mut(); // this causes a panic
|
||||
/// }).join();
|
||||
|
||||
Reference in New Issue
Block a user