Skip to content

Commit 0eef858

Browse files
author
yew005
committed
Remove before contracts. Fix import in
1 parent 8cbca87 commit 0eef858

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

library/core/src/num/int_macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,8 @@ macro_rules! int_impl {
511511
without modifying the original"]
512512
#[inline(always)]
513513
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
514-
#[kani::requires(!self.overflowing_add(rhs).1)]
515-
#[kani::ensures(|ret| *ret >= $SelfT::MIN && *ret <= $SelfT::MAX)]
514+
#[requires(!self.overflowing_add(rhs).1)]
515+
#[ensures(|ret| *ret >= $SelfT::MIN && *ret <= $SelfT::MAX)]
516516
pub const unsafe fn unchecked_add(self, rhs: Self) -> Self {
517517
assert_unsafe_precondition!(
518518
check_language_ub,

library/core/src/num/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
use crate::str::FromStr;
66
use crate::ub_checks::assert_unsafe_precondition;
77
use crate::{ascii, intrinsics, mem};
8+
use safety::{ensures, requires};
9+
10+
#[cfg(kani)]
11+
use crate::kani;
812

913
// Used because the `?` operator is not allowed in a const context.
1014
macro_rules! try_opt {
@@ -1585,9 +1589,6 @@ from_str_radix_size_impl! { i32 isize, u32 usize }
15851589
#[cfg(target_pointer_width = "64")]
15861590
from_str_radix_size_impl! { i64 isize, u64 usize }
15871591

1588-
#[cfg(kani)]
1589-
use crate::kani;
1590-
15911592
#[unstable(feature = "kani", issue = "none")]
15921593
mod verify {
15931594
use super::*;

library/core/src/num/uint_macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ macro_rules! uint_impl {
558558
without modifying the original"]
559559
#[inline(always)]
560560
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
561-
#[kani::requires(!self.overflowing_add(rhs).1)]
562-
#[kani::ensures(|ret| *ret >= $SelfT::MIN && *ret <= $SelfT::MAX)]
561+
#[requires(!self.overflowing_add(rhs).1)]
562+
#[ensures(|ret| *ret >= $SelfT::MIN && *ret <= $SelfT::MAX)]
563563
pub const unsafe fn unchecked_add(self, rhs: Self) -> Self {
564564
assert_unsafe_precondition!(
565565
check_language_ub,

0 commit comments

Comments
 (0)