@@ -887,8 +887,7 @@ mod verify {
887
887
let len = slice. len ( ) ;
888
888
kani:: assume ( slice. len ( ) > 0 && slice[ slice. len ( ) - 1 ] == 0 ) ;
889
889
kani:: assume ( forall ! ( |i in ( 0 , len-1 ) | unsafe { * slice. as_ptr( ) . wrapping_add( i) } != 0 ) ) ;
890
- let ptr = slice. as_ptr ( ) as * const c_char ;
891
- unsafe { CStr :: from_ptr ( ptr) }
890
+ unsafe { & * ( slice as * const [ u8 ] as * const CStr ) }
892
891
}
893
892
894
893
// pub const fn from_bytes_until_nul(bytes: &[u8]) -> Result<&CStr, FromBytesUntilNulError>
@@ -942,7 +941,8 @@ mod verify {
942
941
// Compare the bytes obtained from the iterator and the slice
943
942
// bytes_expected.iter().copied() converts the slice into an iterator over u8
944
943
assert ! ( bytes_iterator. eq( bytes_expected. iter( ) . copied( ) ) ) ;
945
- assert ! ( c_str. is_safe( ) ) ;
944
+ //Will be added after https://github.com/model-checking/kani/issues/4310 is fixed
945
+ //assert!(c_str.is_safe());
946
946
}
947
947
948
948
// pub const fn to_str(&self) -> Result<&str, str::Utf8Error>
@@ -959,7 +959,8 @@ mod verify {
959
959
if let Ok ( s) = str_result {
960
960
assert_eq ! ( s. as_bytes( ) , c_str. to_bytes( ) ) ;
961
961
}
962
- assert ! ( c_str. is_safe( ) ) ;
962
+ //Will be added after https://github.com/model-checking/kani/issues/4310 is fixed
963
+ //assert!(c_str.is_safe());
963
964
}
964
965
965
966
// pub const fn as_ptr(&self) -> *const c_char
@@ -986,7 +987,8 @@ mod verify {
986
987
assert_eq ! ( byte_at_ptr as u8 , byte_in_cstr) ;
987
988
}
988
989
}
989
- assert ! ( c_str. is_safe( ) ) ;
990
+ //Will be added after https://github.com/model-checking/kani/issues/4310 is fixed
991
+ //assert!(c_str.is_safe());
990
992
}
991
993
992
994
// pub const fn from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError>
@@ -1036,7 +1038,8 @@ mod verify {
1036
1038
let end_idx = bytes. len ( ) ;
1037
1039
// Comparison does not include the null byte
1038
1040
assert_eq ! ( bytes, & slice[ ..end_idx] ) ;
1039
- assert ! ( c_str. is_safe( ) ) ;
1041
+ //Will be added after https://github.com/model-checking/kani/issues/4310 is fixed
1042
+ //assert!(c_str.is_safe());
1040
1043
}
1041
1044
1042
1045
// pub const fn to_bytes_with_nul(&self) -> &[u8]
@@ -1052,7 +1055,8 @@ mod verify {
1052
1055
let end_idx = bytes. len ( ) ;
1053
1056
// Comparison includes the null byte
1054
1057
assert_eq ! ( bytes, & slice[ ..end_idx] ) ;
1055
- assert ! ( c_str. is_safe( ) ) ;
1058
+ //Will be added after https://github.com/model-checking/kani/issues/4310 is fixed
1059
+ //assert!(c_str.is_safe());
1056
1060
}
1057
1061
1058
1062
// const unsafe fn strlen(ptr: *const c_char) -> usize
@@ -1093,6 +1097,7 @@ mod verify {
1093
1097
let bytes = c_str. to_bytes ( ) ; // does not include null terminator
1094
1098
let expected_is_empty = bytes. len ( ) == 0 ;
1095
1099
assert_eq ! ( expected_is_empty, c_str. is_empty( ) ) ;
1096
- assert ! ( c_str. is_safe( ) ) ;
1100
+ //Will be added after https://github.com/model-checking/kani/issues/4310 is fixed
1101
+ //assert!(c_str.is_safe());
1097
1102
}
1098
1103
}
0 commit comments