File tree 6 files changed +27
-0
lines changed
6 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -282,6 +282,9 @@ impl<T> Arc<T> {
282
282
/// To avoid a memory leak the pointer must be converted back to an `Arc` using
283
283
/// [`Arc::from_raw`][from_raw].
284
284
///
285
+ /// If `T` is zero-sized (e.g. `Arc<()>`), the returned pointer address
286
+ /// will be meaningless.
287
+ ///
285
288
/// [from_raw]: struct.Arc.html#method.from_raw
286
289
///
287
290
/// # Examples
Original file line number Diff line number Diff line change @@ -274,6 +274,9 @@ impl<T: ?Sized> Box<T> {
274
274
/// proper way to do so is to convert the raw pointer back into a
275
275
/// `Box` with the [`Box::from_raw`] function.
276
276
///
277
+ /// If `T` is zero-sized (e.g. `Box<()>`), the returned pointer address
278
+ /// will be meaningless.
279
+ ///
277
280
/// Note: this is an associated function, which means that you have
278
281
/// to call it as `Box::into_raw(b)` instead of `b.into_raw()`. This
279
282
/// is so that there is no conflict with a method on the inner type.
Original file line number Diff line number Diff line change @@ -359,6 +359,9 @@ impl<T> Rc<T> {
359
359
/// To avoid a memory leak the pointer must be converted back to an `Rc` using
360
360
/// [`Rc::from_raw`][from_raw].
361
361
///
362
+ /// If `T` is zero-sized (e.g. `Rc<()>`), the returned pointer address
363
+ /// will be meaningless.
364
+ ///
362
365
/// [from_raw]: struct.Rc.html#method.from_raw
363
366
///
364
367
/// # Examples
Original file line number Diff line number Diff line change @@ -437,6 +437,9 @@ impl<T> [T] {
437
437
/// The caller must ensure that the slice outlives the pointer this
438
438
/// function returns, or else it will end up pointing to garbage.
439
439
///
440
+ /// If the slice is empty, the returned pointer address will be
441
+ /// meaningless.
442
+ ///
440
443
/// Modifying the slice may cause its buffer to be reallocated, which
441
444
/// would also make any pointers to it invalid.
442
445
///
@@ -463,6 +466,9 @@ impl<T> [T] {
463
466
/// The caller must ensure that the slice outlives the pointer this
464
467
/// function returns, or else it will end up pointing to garbage.
465
468
///
469
+ /// If the slice is empty, the returned pointer address will be
470
+ /// meaningless.
471
+ ///
466
472
/// Modifying the slice may cause its buffer to be reallocated, which
467
473
/// would also make any pointers to it invalid.
468
474
///
Original file line number Diff line number Diff line change @@ -275,6 +275,9 @@ impl str {
275
275
/// [`u8`]. This pointer will be pointing to the first byte of the string
276
276
/// slice.
277
277
///
278
+ /// If the string slice is empty, the returned pointer address will be
279
+ /// meaningless.
280
+ ///
278
281
/// [`u8`]: primitive.u8.html
279
282
///
280
283
/// # Examples
Original file line number Diff line number Diff line change @@ -235,6 +235,9 @@ impl<T:Copy> Cell<T> {
235
235
236
236
/// Returns a raw pointer to the underlying data in this cell.
237
237
///
238
+ /// If `T` is zero-sized (e.g. `Cell<()>`), the returned pointer address
239
+ /// will be meaningless.
240
+ ///
238
241
/// # Examples
239
242
///
240
243
/// ```
@@ -771,6 +774,9 @@ impl<T: ?Sized> RefCell<T> {
771
774
772
775
/// Returns a raw pointer to the underlying data in this cell.
773
776
///
777
+ /// If `T` is zero-sized (e.g. `RefCell<()>`), the returned pointer address
778
+ /// will be meaningless.
779
+ ///
774
780
/// # Examples
775
781
///
776
782
/// ```
@@ -1188,6 +1194,9 @@ impl<T: ?Sized> UnsafeCell<T> {
1188
1194
/// `&mut T`, and ensure that there are no mutations or mutable
1189
1195
/// aliases going on when casting to `&T`
1190
1196
///
1197
+ /// If `T` is zero-sized (e.g. `UnsafeCell<()>`), the returned pointer
1198
+ /// address will be meaningless.
1199
+ ///
1191
1200
/// # Examples
1192
1201
///
1193
1202
/// ```
You can’t perform that action at this time.
0 commit comments