@@ -41,11 +41,12 @@ mod verify {
41
41
42
42
/// Wrapper functions used to verify auto-generated functions from this module.
43
43
///
44
- /// The files in this module is auto-generated by a script, so they are harder to annotate.
45
- /// Instead, for each function that we want to verify, we create a wrapper function and add
46
- /// contracts for them instead .
44
+ /// The files in this module are auto-generated by a script, so they are harder to annotate.
45
+ /// Instead, for each function that we want to verify, we create a wrapper function with
46
+ /// contracts.
47
47
mod wrappers {
48
48
use super :: * ;
49
+ use crate :: ub_checks;
49
50
50
51
/// Wraps `conversions::to_upper` function.
51
52
///
@@ -54,9 +55,7 @@ mod verify {
54
55
/// # todo!()
55
56
/// }
56
57
/// ```
57
- #[ ensures( |res| c. is_ascii( ) == res[ 0 ] . is_ascii( ) ) ]
58
- #[ ensures( |res| if c. is_ascii( ) { & res[ 1 ..2 ] == & [ '\0' , '\0' ] } else { true } ) ]
59
- #[ ensures( |res| if ( 'a' ..'z' ) . contains( & c) { ( 'A' ..'Z' ) . contains( & res[ 0 ] ) } else { c == res[ 0 ] } ) ]
58
+ #[ ensures( |res| ub_checks:: can_dereference( res) ) ]
60
59
pub fn to_upper_wrapper ( c : char ) -> [ char ; 3 ] {
61
60
to_upper ( c)
62
61
}
@@ -68,21 +67,19 @@ mod verify {
68
67
/// # todo!()
69
68
/// }
70
69
/// ```
71
- #[ ensures( |res| c. is_ascii( ) == res[ 0 ] . is_ascii( ) ) ]
72
- #[ ensures( |res| if c. is_ascii( ) { & res[ 1 ..2 ] == & [ '\0' , '\0' ] } else { true } ) ]
73
- #[ ensures( |res| if ( 'A' ..'Z' ) . contains( & c) { ( 'a' ..'z' ) . contains( & res[ 0 ] ) } else { c == res[ 0 ] } ) ]
70
+ #[ ensures( |res| ub_checks:: can_dereference( res) ) ]
74
71
pub fn to_lower_wrapper ( c : char ) -> [ char ; 3 ] {
75
72
to_lower ( c)
76
73
}
77
74
}
78
75
79
76
#[ kani:: proof_for_contract( to_upper_wrapper) ]
80
- fn check_to_upper ( ) {
77
+ fn check_to_upper_safety ( ) {
81
78
let _ = to_upper_wrapper ( kani:: any ( ) ) ;
82
79
}
83
80
84
81
#[ kani:: proof_for_contract( to_lower_wrapper) ]
85
- fn check_to_lower ( ) {
86
- let _ = to_upper_wrapper ( kani:: any ( ) ) ;
82
+ fn check_to_lower_safety ( ) {
83
+ let _ = to_lower_wrapper ( kani:: any ( ) ) ;
87
84
}
88
85
}
0 commit comments