diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-05-22 03:47:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-22 03:47:32 +0200 |
| commit | 40a18a1df52ad3b499b002e4493590f553aae954 (patch) | |
| tree | e0c21d74d83469fec34a1f5cf92cf7952e551681 /src/test/ui/thinlto | |
| parent | d69ef04af59b4e4c4c50fb2cc09d958ae879556a (diff) | |
| parent | 4e37785c7d6ef85d00833e93943cdee28baf97b3 (diff) | |
| download | rust-40a18a1df52ad3b499b002e4493590f553aae954.tar.gz rust-40a18a1df52ad3b499b002e4493590f553aae954.zip | |
Rollup merge of #60963 - blkerby:boxed_docs, r=alexcrichton
Update boxed::Box docs on memory layout The existing docs for the `Box` type state that "the way `Box` allocates and releases memory is unspecified", and that therefore the only valid pointer to pass to `Box::from_raw` is one obtained from `Box::into_raw`. This is inconsistent with the module-level docs which specify, > It is valid to convert both ways between a Box and a raw pointer allocated with the Global allocator, given that the Layout used with the allocator is correct for the type. More precisely, a value: *mut T that has been allocated with the Global allocator with Layout::for_value(&*value) may be converted into a box using Box::<T>::from_raw(value). Conversely, the memory backing a value: *mut T obtained from Box::<T>::into_raw may be deallocated using the Global allocator with Layout::for_value(&*value). This pull request updates the docs for `Box` to make them consistent with the module-level docs and adds some examples of how to use the global allocator in conjunction with `Box::from_raw` and `Box::into_raw`.
Diffstat (limited to 'src/test/ui/thinlto')
0 files changed, 0 insertions, 0 deletions
