Skip to content

Commit 38f3d67

Browse files
committed
Add #[miri::intrinsic_fallback_is_spec] to contract_check_{ensures,requires}
See #136578 (comment).
1 parent 766a5b5 commit 38f3d67

File tree

1 file changed

+3
-0
lines changed
  • library/core/src/intrinsics

1 file changed

+3
-0
lines changed

library/core/src/intrinsics/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -3410,6 +3410,7 @@ pub const fn contract_checks() -> bool {
34103410
// doesn't honor `#[allow_internal_unstable]`, so for the const feature gate we use the user-facing
34113411
// `contracts` feature rather than the perma-unstable `contracts_internals`
34123412
#[rustc_const_unstable(feature = "contracts", issue = "128044")]
3413+
#[miri::intrinsic_fallback_is_spec]
34133414
#[lang = "contract_check_requires"]
34143415
#[rustc_intrinsic]
34153416
pub const fn contract_check_requires<C: Fn() -> bool + Copy>(cond: C) {
@@ -3438,6 +3439,7 @@ pub const fn contract_check_requires<C: Fn() -> bool + Copy>(cond: C) {
34383439
// `contracts` feature rather than the perma-unstable `contracts_internals`.
34393440
// Const-checking doesn't honor allow_internal_unstable logic used by contract expansion.
34403441
#[rustc_const_unstable(feature = "contracts", issue = "128044")]
3442+
#[miri::intrinsic_fallback_is_spec]
34413443
#[lang = "contract_check_ensures"]
34423444
#[rustc_intrinsic]
34433445
pub const fn contract_check_ensures<C: Fn(&Ret) -> bool + Copy, Ret>(cond: C, ret: Ret) -> Ret {
@@ -3459,6 +3461,7 @@ pub const fn contract_check_ensures<C: Fn(&Ret) -> bool + Copy, Ret>(cond: C, re
34593461
/// This is the old version of contract_check_ensures kept here for bootstrap only.
34603462
#[cfg(bootstrap)]
34613463
#[unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)]
3464+
#[miri::intrinsic_fallback_is_spec]
34623465
#[rustc_intrinsic]
34633466
pub fn contract_check_ensures<'a, Ret, C: Fn(&'a Ret) -> bool>(ret: &'a Ret, cond: C) {
34643467
if contract_checks() && !cond(ret) {

0 commit comments

Comments
 (0)