Skip to content

Commit

Permalink
Add ensures for unchecked_neg && Fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
Yenyun035 committed Oct 8, 2024
1 parent 5e1c45f commit cb99f76
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions library/core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,7 @@ macro_rules! int_impl {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
#[requires(self != $SelfT::MIN)]
#[ensures(|result| *result == -self)]
pub const unsafe fn unchecked_neg(self) -> Self {
assert_unsafe_precondition!(
check_language_ub,
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use crate::str::FromStr;
use crate::ub_checks::assert_unsafe_precondition;
use crate::{ascii, intrinsics, mem};
use safety::requires;
use safety::{requires, ensures};

#[cfg(kani)]
use crate::kani;
Expand Down

0 comments on commit cb99f76

Please sign in to comment.