File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 8181 - name : Run Kani Verification
8282 run : |
8383 scripts/run-kani.sh --run autoharness --kani-args \
84+ --include-pattern ">::disjoint_bitor" \
85+ --include-pattern ">::unchecked_disjoint_bitor" \
8486 --include-pattern alloc::layout::Layout::from_size_align \
8587 --include-pattern ascii::ascii_char::AsciiChar::from_u8 \
8688 --include-pattern char::convert::from_u32_unchecked \
Original file line number Diff line number Diff line change 77) ]
88#![ allow( missing_docs) ]
99
10+ use safety:: requires;
11+
12+ #[ cfg( kani) ]
13+ use crate :: kani;
14+
1015#[ const_trait]
1116#[ rustc_const_unstable( feature = "core_intrinsics_fallbacks" , issue = "none" ) ]
1217pub trait CarryingMulAdd : Copy + ' static {
@@ -132,6 +137,7 @@ macro_rules! impl_disjoint_bitor {
132137 impl const DisjointBitOr for $t {
133138 #[ cfg_attr( miri, track_caller) ]
134139 #[ inline]
140+ #[ requires( ( self & other) == zero!( $t) ) ]
135141 unsafe fn disjoint_bitor( self , other: Self ) -> Self {
136142 // Note that the assume here is required for UB detection in Miri!
137143
Original file line number Diff line number Diff line change @@ -1265,6 +1265,7 @@ macro_rules! uint_impl {
12651265 #[ unstable( feature = "disjoint_bitor" , issue = "135758" ) ]
12661266 #[ rustc_const_unstable( feature = "disjoint_bitor" , issue = "135758" ) ]
12671267 #[ inline]
1268+ #[ requires( ( self & other) == 0 ) ]
12681269 pub const unsafe fn unchecked_disjoint_bitor( self , other: Self ) -> Self {
12691270 assert_unsafe_precondition!(
12701271 check_language_ub,
You can’t perform that action at this time.
0 commit comments