File tree 3 files changed +16
-0
lines changed
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;
71
71
/// does not use atomics, making it both thread-unsafe as well as significantly
72
72
/// faster when updating the reference count.
73
73
///
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
+ ///
74
80
/// # Examples
75
81
///
76
82
/// 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> {
271
271
/// proper way to do so is to convert the raw pointer back into a
272
272
/// `Box` with the `Box::from_raw` function.
273
273
///
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
+ ///
274
278
/// # Examples
275
279
///
276
280
/// ```
Original file line number Diff line number Diff line change @@ -182,6 +182,12 @@ struct RcBox<T: ?Sized> {
182
182
/// A reference-counted pointer type over an immutable value.
183
183
///
184
184
/// 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.
185
191
#[ cfg_attr( stage0, unsafe_no_drop_flag) ]
186
192
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
187
193
pub struct Rc < T : ?Sized > {
You can’t perform that action at this time.
0 commit comments