File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 63
63
//! [`Global`] allocator with [`Layout::for_value(&*value)`].
64
64
//!
65
65
//! For zero-sized values, the `Box` pointer still has to be [valid] for reads and writes and
66
- //! sufficiently aligned. In particular, casting any aligned non-zero integer to a raw pointer
67
- //! produces a valid pointer, but a pointer pointing into previously allocated memory that since got
68
- //! freed is not valid.
66
+ //! sufficiently aligned. In particular, casting any aligned non-zero integer literal to a raw
67
+ //! pointer produces a valid pointer, but a pointer pointing into previously allocated memory that
68
+ //! since got freed is not valid.
69
69
//!
70
70
//! So long as `T: Sized`, a `Box<T>` is guaranteed to be represented
71
71
//! as a single pointer and is also ABI-compatible with C pointers
Original file line number Diff line number Diff line change 21
21
//! within the bounds of a single allocated object. Note that in Rust,
22
22
//! every (stack-allocated) variable is considered a separate allocated object.
23
23
//! * Even for operations of [size zero][zst], the pointer must not be "dangling" in the sense of
24
- //! pointing to deallocated memory. However, casting any non-zero integer to a pointer is valid
25
- //! for zero-sized accesses. This corresponds to writing your own allocator; allocating zero-sized
26
- //! objects is not very hard. In contrast, when you use the standard allocator, after memory got
27
- //! deallocated, even zero-sized accesses to that memory are invalid.
24
+ //! pointing to deallocated memory. However, casting any non-zero integer literal to a pointer is
25
+ //! valid for zero-sized accesses. This corresponds to writing your own allocator; allocating
26
+ //! zero-sized objects is not very hard. In contrast, when you use the standard allocator, after
27
+ //! memory got deallocated, even zero-sized accesses to that memory are invalid.
28
28
//! * All accesses performed by functions in this module are *non-atomic* in the sense
29
29
//! of [atomic operations] used to synchronize between threads. This means it is
30
30
//! undefined behavior to perform two concurrent accesses to the same location from different
You can’t perform that action at this time.
0 commit comments