File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,12 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
7171/// does not use atomics, making it both thread-unsafe as well as significantly
7272/// faster when updating the reference count.
7373///
74+ /// Note: the inherent methods defined on `Arc<T>` are all associated functions,
75+ /// which means that you have to call them as e.g. `Arc::get_mut(&value)`
76+ /// instead of `value.get_mut()`. This is so that there are no conflicts with
77+ /// methods on the inner type `T`, which are what you want to call in the
78+ /// majority of cases.
79+ ///
7480/// # Examples
7581///
7682/// In this example, a large vector of data will be shared by several threads. First we
Original file line number Diff line number Diff line change @@ -271,6 +271,10 @@ impl<T: ?Sized> Box<T> {
271271 /// proper way to do so is to convert the raw pointer back into a
272272 /// `Box` with the `Box::from_raw` function.
273273 ///
274+ /// Note: this is an associated function, which means that you have
275+ /// to call it as `Box::into_raw(b)` instead of `b.into_raw()`. This
276+ /// is so that there is no conflict with a method on the inner type.
277+ ///
274278 /// # Examples
275279 ///
276280 /// ```
Original file line number Diff line number Diff line change @@ -182,6 +182,12 @@ struct RcBox<T: ?Sized> {
182182/// A reference-counted pointer type over an immutable value.
183183///
184184/// See the [module level documentation](./index.html) for more details.
185+ ///
186+ /// Note: the inherent methods defined on `Rc<T>` are all associated functions,
187+ /// which means that you have to call them as e.g. `Rc::get_mut(&value)` instead
188+ /// of `value.get_mut()`. This is so that there are no conflicts with methods
189+ /// on the inner type `T`, which are what you want to call in the majority of
190+ /// cases.
185191#[ cfg_attr( stage0, unsafe_no_drop_flag) ]
186192#[ stable( feature = "rust1" , since = "1.0.0" ) ]
187193pub struct Rc < T : ?Sized > {
You can’t perform that action at this time.
0 commit comments