Skip to content

Commit 6ed9660

Browse files
authored
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`.
2 parents 47f5211 + db4e60b commit 6ed9660

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

library/alloc/src/boxed.rs

+3
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ use crate::vec::Vec;
169169
#[lang = "owned_box"]
170170
#[fundamental]
171171
#[stable(feature = "rust1", since = "1.0.0")]
172+
// The declaration of the `Box` struct must be kept in sync with the
173+
// `alloc::alloc::box_free` function or ICEs will happen. See the comment
174+
// on `box_free` for more details.
172175
pub struct Box<
173176
T: ?Sized,
174177
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,

0 commit comments

Comments
 (0)