Skip to content

Commit d53a5d8

Browse files
committed
Ensure miri only uses fallback bodies that have manually been vetted to preserve all UB that the native intrinsic would have
1 parent 05d6270 commit d53a5d8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/intrinsics.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,7 @@ pub const unsafe fn assume(b: bool) {
987987
#[unstable(feature = "core_intrinsics", issue = "none")]
988988
#[rustc_intrinsic]
989989
#[rustc_nounwind]
990+
#[cfg_attr(not(bootstrap), miri::intrinsic_fallback_checks_ub)]
990991
pub const fn likely(b: bool) -> bool {
991992
b
992993
}
@@ -1006,6 +1007,7 @@ pub const fn likely(b: bool) -> bool {
10061007
#[unstable(feature = "core_intrinsics", issue = "none")]
10071008
#[rustc_intrinsic]
10081009
#[rustc_nounwind]
1010+
#[cfg_attr(not(bootstrap), miri::intrinsic_fallback_checks_ub)]
10091011
pub const fn unlikely(b: bool) -> bool {
10101012
b
10111013
}
@@ -2526,6 +2528,7 @@ extern "rust-intrinsic" {
25262528
#[rustc_nounwind]
25272529
#[rustc_do_not_const_check]
25282530
#[inline]
2531+
#[cfg_attr(not(bootstrap), miri::intrinsic_fallback_checks_ub)]
25292532
pub const fn ptr_guaranteed_cmp<T>(ptr: *const T, other: *const T) -> u8 {
25302533
(ptr == other) as u8
25312534
}

0 commit comments

Comments
 (0)