Skip to content

Commit 8db6fc4

Browse files
committed
Give the (un)likely intrinsics fallback bodies
1 parent 388f774 commit 8db6fc4

File tree

1 file changed

+37
-31
lines changed

1 file changed

+37
-31
lines changed

core/src/intrinsics.rs

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -960,39 +960,45 @@ pub const unsafe fn assume(b: bool) {
960960
}
961961
}
962962

963-
extern "rust-intrinsic" {
964-
/// Hints to the compiler that branch condition is likely to be true.
965-
/// Returns the value passed to it.
966-
///
967-
/// Any use other than with `if` statements will probably not have an effect.
968-
///
969-
/// Note that, unlike most intrinsics, this is safe to call;
970-
/// it does not require an `unsafe` block.
971-
/// Therefore, implementations must not require the user to uphold
972-
/// any safety invariants.
973-
///
974-
/// This intrinsic does not have a stable counterpart.
975-
#[rustc_const_unstable(feature = "const_likely", issue = "none")]
976-
#[rustc_safe_intrinsic]
977-
#[rustc_nounwind]
978-
pub fn likely(b: bool) -> bool;
963+
/// Hints to the compiler that branch condition is likely to be true.
964+
/// Returns the value passed to it.
965+
///
966+
/// Any use other than with `if` statements will probably not have an effect.
967+
///
968+
/// Note that, unlike most intrinsics, this is safe to call;
969+
/// it does not require an `unsafe` block.
970+
/// Therefore, implementations must not require the user to uphold
971+
/// any safety invariants.
972+
///
973+
/// This intrinsic does not have a stable counterpart.
974+
#[rustc_const_unstable(feature = "const_likely", issue = "none")]
975+
#[unstable(feature = "core_intrinsics", issue = "none")]
976+
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
977+
#[rustc_nounwind]
978+
pub const fn likely(b: bool) -> bool {
979+
b
980+
}
979981

980-
/// Hints to the compiler that branch condition is likely to be false.
981-
/// Returns the value passed to it.
982-
///
983-
/// Any use other than with `if` statements will probably not have an effect.
984-
///
985-
/// Note that, unlike most intrinsics, this is safe to call;
986-
/// it does not require an `unsafe` block.
987-
/// Therefore, implementations must not require the user to uphold
988-
/// any safety invariants.
989-
///
990-
/// This intrinsic does not have a stable counterpart.
991-
#[rustc_const_unstable(feature = "const_likely", issue = "none")]
992-
#[rustc_safe_intrinsic]
993-
#[rustc_nounwind]
994-
pub fn unlikely(b: bool) -> bool;
982+
/// Hints to the compiler that branch condition is likely to be false.
983+
/// Returns the value passed to it.
984+
///
985+
/// Any use other than with `if` statements will probably not have an effect.
986+
///
987+
/// Note that, unlike most intrinsics, this is safe to call;
988+
/// it does not require an `unsafe` block.
989+
/// Therefore, implementations must not require the user to uphold
990+
/// any safety invariants.
991+
///
992+
/// This intrinsic does not have a stable counterpart.
993+
#[rustc_const_unstable(feature = "const_likely", issue = "none")]
994+
#[unstable(feature = "core_intrinsics", issue = "none")]
995+
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
996+
#[rustc_nounwind]
997+
pub const fn unlikely(b: bool) -> bool {
998+
b
999+
}
9951000

1001+
extern "rust-intrinsic" {
9961002
/// Executes a breakpoint trap, for inspection by a debugger.
9971003
///
9981004
/// This intrinsic does not have a stable counterpart.

0 commit comments

Comments
 (0)