Improve grammar of Box::{into,from}_raw docs
This commit is contained in:
parent
1447ce78fb
commit
6a4f3b2335
@ -237,17 +237,17 @@ impl<T> Box<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T: ?Sized> Box<T> {
|
impl<T: ?Sized> Box<T> {
|
||||||
/// Constructs a box from the raw pointer.
|
/// Constructs a box from a raw pointer.
|
||||||
///
|
///
|
||||||
/// After this function call, pointer is owned by resulting box.
|
/// After calling this function, the raw pointer is owned by the
|
||||||
/// In particular, it means that `Box` destructor calls destructor
|
/// resulting `Box`. Specifically, the `Box` destructor will call
|
||||||
/// of `T` and releases memory. Since the way `Box` allocates and
|
/// the destructor of `T` and free the allocated memory. Since the
|
||||||
/// releases memory is unspecified, the only valid pointer to pass
|
/// way `Box` allocates and releases memory is unspecified, the
|
||||||
/// to this function is the one taken from another `Box` with
|
/// only valid pointer to pass to this function is the one taken
|
||||||
/// `Box::into_raw` function.
|
/// from another `Box` via the `Box::into_raw` function.
|
||||||
///
|
///
|
||||||
/// Function is unsafe, because improper use of this function may
|
/// This function is unsafe because improper use may lead to
|
||||||
/// lead to memory problems like double-free, for example if the
|
/// memory problems. For example, a double-free may occur if the
|
||||||
/// function is called twice on the same raw pointer.
|
/// function is called twice on the same raw pointer.
|
||||||
#[stable(feature = "box_raw", since = "1.4.0")]
|
#[stable(feature = "box_raw", since = "1.4.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -257,11 +257,11 @@ impl<T: ?Sized> Box<T> {
|
|||||||
|
|
||||||
/// Consumes the `Box`, returning the wrapped raw pointer.
|
/// Consumes the `Box`, returning the wrapped raw pointer.
|
||||||
///
|
///
|
||||||
/// After call to this function, caller is responsible for the memory
|
/// After calling this function, the caller is responsible for the
|
||||||
/// previously managed by `Box`, in particular caller should properly
|
/// memory previously managed by the `Box`. In particular, the
|
||||||
/// destroy `T` and release memory. The proper way to do it is to
|
/// caller should properly destroy `T` and release the memory. The
|
||||||
/// convert pointer back to `Box` with `Box::from_raw` function, because
|
/// proper way to do so is to convert the raw pointer back into a
|
||||||
/// `Box` does not specify, how memory is allocated.
|
/// `Box` with the `Box::from_raw` function.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user