File tree 3 files changed +9
-0
lines changed 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 81
81
- name : Run Kani Verification
82
82
run : |
83
83
scripts/run-kani.sh --run autoharness --kani-args \
84
+ --include-pattern ">::disjoint_bitor" \
85
+ --include-pattern ">::unchecked_disjoint_bitor" \
84
86
--include-pattern alloc::layout::Layout::from_size_align \
85
87
--include-pattern ascii::ascii_char::AsciiChar::from_u8 \
86
88
--include-pattern char::convert::from_u32_unchecked \
Original file line number Diff line number Diff line change
1
+ use safety:: requires;
2
+
3
+ #[ cfg( kani) ]
4
+ use crate :: kani;
5
+
1
6
#![ unstable(
2
7
feature = "core_intrinsics_fallbacks" ,
3
8
reason = "The fallbacks will never be stable, as they exist only to be called \
@@ -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) == 0 ) ]
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