Skip to content

Commit 72396d9

Browse files
committed
Clarify that UB will occur, not can/may in GlobalAlloc docs
1 parent 4b94758 commit 72396d9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/core/src/alloc/global.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ pub unsafe trait GlobalAlloc {
124124
///
125125
/// # Safety
126126
///
127-
/// `layout` must have non-zero size. Attempting to allocate for a zero-sized `layout` may
127+
/// `layout` must have non-zero size. Attempting to allocate for a zero-sized `layout` will
128128
/// result in undefined behavior.
129129
///
130130
/// (Extension subtraits might provide more specific bounds on
@@ -163,7 +163,7 @@ pub unsafe trait GlobalAlloc {
163163
/// * `layout` is the same layout that was used to allocate that block of
164164
/// memory.
165165
///
166-
/// Otherwise undefined behavior can result.
166+
/// Otherwise the behavior is undefined.
167167
#[stable(feature = "global_alloc", since = "1.28.0")]
168168
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout);
169169

@@ -173,7 +173,7 @@ pub unsafe trait GlobalAlloc {
173173
/// # Safety
174174
///
175175
/// The caller has to ensure that `layout` has non-zero size. Like `alloc`
176-
/// zero sized `layout` can result in undefined behavior.
176+
/// zero sized `layout` will result in undefined behavior.
177177
/// However the allocated block of memory is guaranteed to be initialized.
178178
///
179179
/// # Errors
@@ -234,7 +234,7 @@ pub unsafe trait GlobalAlloc {
234234
/// does not overflow `isize` (i.e., the rounded value must be less than or
235235
/// equal to `isize::MAX`).
236236
///
237-
/// If these are not followed, undefined behavior can result.
237+
/// If these are not followed, the behavior is undefined.
238238
///
239239
/// (Extension subtraits might provide more specific bounds on
240240
/// behavior, e.g., guarantee a sentinel address or a null pointer

0 commit comments

Comments
 (0)