diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs index 03a402a5a47..b73c9270929 100644 --- a/library/std/src/thread/local.rs +++ b/library/std/src/thread/local.rs @@ -604,10 +604,10 @@ impl LocalKey> { /// static X: RefCell> = RefCell::new(Vec::new()); /// } /// - /// X.with_ref(|v| assert!(v.is_empty())); + /// X.with_borrow(|v| assert!(v.is_empty())); /// ``` #[unstable(feature = "local_key_cell_methods", issue = "none")] - pub fn with_ref(&'static self, f: F) -> R + pub fn with_borrow(&'static self, f: F) -> R where F: FnOnce(&T) -> R, { @@ -636,12 +636,12 @@ impl LocalKey> { /// static X: RefCell> = RefCell::new(Vec::new()); /// } /// - /// X.with_mut(|v| v.push(1)); + /// X.with_borrow_mut(|v| v.push(1)); /// - /// X.with_ref(|v| assert_eq!(*v, vec![1])); + /// X.with_borrow(|v| assert_eq!(*v, vec![1])); /// ``` #[unstable(feature = "local_key_cell_methods", issue = "none")] - pub fn with_mut(&'static self, f: F) -> R + pub fn with_borrow_mut(&'static self, f: F) -> R where F: FnOnce(&mut T) -> R, { @@ -673,7 +673,7 @@ impl LocalKey> { /// /// X.set(vec![1, 2, 3]); // But X.set() is fine, as it skips the initializer above. /// - /// X.with_ref(|v| assert_eq!(*v, vec![1, 2, 3])); + /// X.with_borrow(|v| assert_eq!(*v, vec![1, 2, 3])); /// ``` #[unstable(feature = "local_key_cell_methods", issue = "none")] pub fn set(&'static self, value: T) { @@ -706,13 +706,13 @@ impl LocalKey> { /// static X: RefCell> = RefCell::new(Vec::new()); /// } /// - /// X.with_mut(|v| v.push(1)); + /// X.with_borrow_mut(|v| v.push(1)); /// /// let a = X.take(); /// /// assert_eq!(a, vec![1]); /// - /// X.with_ref(|v| assert!(v.is_empty())); + /// X.with_borrow(|v| assert!(v.is_empty())); /// ``` #[unstable(feature = "local_key_cell_methods", issue = "none")] pub fn take(&'static self) -> T @@ -744,7 +744,7 @@ impl LocalKey> { /// let prev = X.replace(vec![1, 2, 3]); /// assert!(prev.is_empty()); /// - /// X.with_ref(|v| assert_eq!(*v, vec![1, 2, 3])); + /// X.with_borrow(|v| assert_eq!(*v, vec![1, 2, 3])); /// ``` #[unstable(feature = "local_key_cell_methods", issue = "none")] pub fn replace(&'static self, value: T) -> T {