Skip to content

Commit 28fca59

Browse files
authored
Rollup merge of #122232 - RalfJung:misc, r=jhpratt
library/core: fix a comment, and a cfg(miri) warning Just two things I noticed while working on another PR.
2 parents 23898d8 + 1082c36 commit 28fca59

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

library/core/src/intrinsics.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3120,6 +3120,7 @@ pub(crate) const fn miri_promise_symbolic_alignment(ptr: *const (), align: usize
31203120

31213121
const fn compiletime(_ptr: *const (), _align: usize) {}
31223122

3123+
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
31233124
// SAFETY: the extra behavior at runtime is for UB checks only.
31243125
unsafe {
31253126
const_eval_select((ptr, align), compiletime, runtime);

library/core/src/ptr/const_ptr.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1628,12 +1628,12 @@ impl<T: ?Sized> *const T {
16281628
#[inline]
16291629
const fn const_impl(ptr: *const (), align: usize) -> bool {
16301630
// We can't use the address of `self` in a `const fn`, so we use `align_offset` instead.
1631-
// The cast to `()` is used to
1632-
// 1. deal with fat pointers; and
1633-
// 2. ensure that `align_offset` doesn't actually try to compute an offset.
16341631
ptr.align_offset(align) == 0
16351632
}
16361633

1634+
// The cast to `()` is used to
1635+
// 1. deal with fat pointers; and
1636+
// 2. ensure that `align_offset` (in `const_impl`) doesn't actually try to compute an offset.
16371637
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
16381638
// SAFETY: The two versions are equivalent at runtime.
16391639
unsafe {

library/core/src/ptr/mut_ptr.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1900,12 +1900,12 @@ impl<T: ?Sized> *mut T {
19001900
#[inline]
19011901
const fn const_impl(ptr: *mut (), align: usize) -> bool {
19021902
// We can't use the address of `self` in a `const fn`, so we use `align_offset` instead.
1903-
// The cast to `()` is used to
1904-
// 1. deal with fat pointers; and
1905-
// 2. ensure that `align_offset` doesn't actually try to compute an offset.
19061903
ptr.align_offset(align) == 0
19071904
}
19081905

1906+
// The cast to `()` is used to
1907+
// 1. deal with fat pointers; and
1908+
// 2. ensure that `align_offset` (in `const_impl`) doesn't actually try to compute an offset.
19091909
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
19101910
// SAFETY: The two versions are equivalent at runtime.
19111911
unsafe {

0 commit comments

Comments
 (0)