diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-11-09 19:00:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-09 19:00:46 +0100 |
| commit | 9c1aa12ff11257c8a149b76e21e3cccac1893350 (patch) | |
| tree | 51d3d43f806a176d21562fb0de88232642631cf2 | |
| parent | fd5a4f42ad425a19c022fcafe482341e2612f29e (diff) | |
| parent | db4e60b29f863bbf78351b7f095b221ffe7b93a6 (diff) | |
| download | rust-9c1aa12ff11257c8a149b76e21e3cccac1893350.tar.gz rust-9c1aa12ff11257c8a149b76e21e3cccac1893350.zip | |
Rollup merge of #90723 - asquared31415:box_docs, r=jyn514
Better document `Box` and `alloc::alloc::box_free` connection The internal `alloc::alloc::box_free` function requires that its signature matches the `owned_box` struct's declaration, but previously that connection was only documented on the `box_free` function. This PR makes the documentation two-way to help anyone making theoretical changes to `Box` to see the connection, since changes are more likely to originate from `Box`.
| -rw-r--r-- | library/alloc/src/boxed.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index bd4f5256042..f6332b072cf 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -169,6 +169,9 @@ use crate::vec::Vec; #[lang = "owned_box"] #[fundamental] #[stable(feature = "rust1", since = "1.0.0")] +// The declaration of the `Box` struct must be kept in sync with the +// `alloc::alloc::box_free` function or ICEs will happen. See the comment +// on `box_free` for more details. pub struct Box< T: ?Sized, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, |
