File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 78
78
# possible functions as that may take a lot longer than expected. Instead,
79
79
# explicitly list all functions (or prefixes thereof) the proofs of which
80
80
# are known to pass.
81
+ # Notes:
82
+ # - We use >::disjoint_bitor (and >::unchecked_disjoint_bitor) as pattern
83
+ # as whitespace is not supported, cf.
84
+ # https://github.com/model-checking/kani/issues/4046
81
85
- name : Run Kani Verification
82
86
run : |
83
87
scripts/run-kani.sh --run autoharness --kani-args \
88
+ --include-pattern ">::disjoint_bitor" \
89
+ --include-pattern ">::unchecked_disjoint_bitor" \
84
90
--include-pattern alloc::__default_lib_allocator:: \
85
91
--include-pattern alloc::layout::Layout::from_size_align \
86
92
--include-pattern ascii::ascii_char::AsciiChar::from_u8 \
Original file line number Diff line number Diff line change 7
7
) ]
8
8
#![ allow( missing_docs) ]
9
9
10
+ use safety:: requires;
11
+
12
+ #[ cfg( kani) ]
13
+ use crate :: kani;
14
+
10
15
#[ const_trait]
11
16
#[ rustc_const_unstable( feature = "core_intrinsics_fallbacks" , issue = "none" ) ]
12
17
pub trait CarryingMulAdd : Copy + ' static {
@@ -132,6 +137,7 @@ macro_rules! impl_disjoint_bitor {
132
137
impl const DisjointBitOr for $t {
133
138
#[ cfg_attr( miri, track_caller) ]
134
139
#[ inline]
140
+ #[ requires( ( self & other) == zero!( $t) ) ]
135
141
unsafe fn disjoint_bitor( self , other: Self ) -> Self {
136
142
// Note that the assume here is required for UB detection in Miri!
137
143
Original file line number Diff line number Diff line change @@ -1265,6 +1265,7 @@ macro_rules! uint_impl {
1265
1265
#[ unstable( feature = "disjoint_bitor" , issue = "135758" ) ]
1266
1266
#[ rustc_const_unstable( feature = "disjoint_bitor" , issue = "135758" ) ]
1267
1267
#[ inline]
1268
+ #[ requires( ( self & other) == 0 ) ]
1268
1269
pub const unsafe fn unchecked_disjoint_bitor( self , other: Self ) -> Self {
1269
1270
assert_unsafe_precondition!(
1270
1271
check_language_ub,
You can’t perform that action at this time.
0 commit comments