Skip to content

Commit 9d4d5a4

Browse files
committed
core: document that the align_of* functions return the alignment in bytes
1 parent 15a242a commit 9d4d5a4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: library/core/src/mem/mod.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ pub const unsafe fn size_of_val_raw<T: ?Sized>(val: *const T) -> usize {
383383
unsafe { intrinsics::size_of_val(val) }
384384
}
385385

386-
/// Returns the [ABI]-required minimum alignment of a type.
386+
/// Returns the [ABI]-required minimum alignment of a type in bytes.
387387
///
388388
/// Every reference to a value of the type `T` must be a multiple of this number.
389389
///
@@ -407,7 +407,8 @@ pub fn min_align_of<T>() -> usize {
407407
intrinsics::min_align_of::<T>()
408408
}
409409

410-
/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to.
410+
/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to in
411+
/// bytes.
411412
///
412413
/// Every reference to a value of the type `T` must be a multiple of this number.
413414
///
@@ -430,7 +431,7 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
430431
unsafe { intrinsics::min_align_of_val(val) }
431432
}
432433

433-
/// Returns the [ABI]-required minimum alignment of a type.
434+
/// Returns the [ABI]-required minimum alignment of a type in bytes.
434435
///
435436
/// Every reference to a value of the type `T` must be a multiple of this number.
436437
///
@@ -454,7 +455,8 @@ pub const fn align_of<T>() -> usize {
454455
intrinsics::min_align_of::<T>()
455456
}
456457

457-
/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to.
458+
/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to in
459+
/// bytes.
458460
///
459461
/// Every reference to a value of the type `T` must be a multiple of this number.
460462
///
@@ -477,7 +479,8 @@ pub const fn align_of_val<T: ?Sized>(val: &T) -> usize {
477479
unsafe { intrinsics::min_align_of_val(val) }
478480
}
479481

480-
/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to.
482+
/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to in
483+
/// bytes.
481484
///
482485
/// Every reference to a value of the type `T` must be a multiple of this number.
483486
///

0 commit comments

Comments
 (0)