Skip to content

Commit a964c86

Browse files
committed
Rollup merge of #30892 - shepmaster:box-grammar, r=alexcrichton
2 parents 92aa326 + 6a4f3b2 commit a964c86

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/liballoc/boxed.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -237,17 +237,17 @@ impl<T> Box<T> {
237237
}
238238

239239
impl<T: ?Sized> Box<T> {
240-
/// Constructs a box from the raw pointer.
240+
/// Constructs a box from a raw pointer.
241241
///
242-
/// After this function call, pointer is owned by resulting box.
243-
/// In particular, it means that `Box` destructor calls destructor
244-
/// of `T` and releases memory. Since the way `Box` allocates and
245-
/// releases memory is unspecified, the only valid pointer to pass
246-
/// to this function is the one taken from another `Box` with
247-
/// `Box::into_raw` function.
242+
/// After calling this function, the raw pointer is owned by the
243+
/// resulting `Box`. Specifically, the `Box` destructor will call
244+
/// the destructor of `T` and free the allocated memory. Since the
245+
/// way `Box` allocates and releases memory is unspecified, the
246+
/// only valid pointer to pass to this function is the one taken
247+
/// from another `Box` via the `Box::into_raw` function.
248248
///
249-
/// Function is unsafe, because improper use of this function may
250-
/// lead to memory problems like double-free, for example if the
249+
/// This function is unsafe because improper use may lead to
250+
/// memory problems. For example, a double-free may occur if the
251251
/// function is called twice on the same raw pointer.
252252
#[stable(feature = "box_raw", since = "1.4.0")]
253253
#[inline]
@@ -257,11 +257,11 @@ impl<T: ?Sized> Box<T> {
257257

258258
/// Consumes the `Box`, returning the wrapped raw pointer.
259259
///
260-
/// After call to this function, caller is responsible for the memory
261-
/// previously managed by `Box`, in particular caller should properly
262-
/// destroy `T` and release memory. The proper way to do it is to
263-
/// convert pointer back to `Box` with `Box::from_raw` function, because
264-
/// `Box` does not specify, how memory is allocated.
260+
/// After calling this function, the caller is responsible for the
261+
/// memory previously managed by the `Box`. In particular, the
262+
/// caller should properly destroy `T` and release the memory. The
263+
/// proper way to do so is to convert the raw pointer back into a
264+
/// `Box` with the `Box::from_raw` function.
265265
///
266266
/// # Examples
267267
///

0 commit comments

Comments
 (0)