Skip to content

Commit a0aaf57

Browse files
authored
Remove wrappers and contracts per PR comments (#2)
1 parent ebfa3d8 commit a0aaf57

File tree

1 file changed

+6
-40
lines changed
  • library/core/src/unicode

1 file changed

+6
-40
lines changed

library/core/src/unicode/mod.rs

+6-40
Original file line numberDiff line numberDiff line change
@@ -35,51 +35,17 @@ pub const UNICODE_VERSION: (u8, u8, u8) = unicode_data::UNICODE_VERSION;
3535
#[cfg(kani)]
3636
mod verify {
3737
use super::conversions::{to_upper, to_lower};
38-
use wrappers::*;
3938
use crate::kani;
40-
use safety::*;
4139

42-
/// Wrapper functions used to verify auto-generated functions from this module.
43-
///
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-
mod wrappers {
48-
use super::*;
49-
use crate::ub_checks;
50-
51-
/// Wraps `conversions::to_upper` function.
52-
///
53-
/// ```no_run
54-
/// pub fn to_upper(c: char) -> [char; 3] {
55-
/// # todo!()
56-
/// }
57-
/// ```
58-
#[ensures(|res| ub_checks::can_dereference(res))]
59-
pub fn to_upper_wrapper(c: char) -> [char; 3] {
60-
to_upper(c)
61-
}
62-
63-
/// Wraps `conversions::to_lower` function.
64-
///
65-
/// ```no_run
66-
/// pub fn to_lower(c: char) -> [char; 3] {
67-
/// # todo!()
68-
/// }
69-
/// ```
70-
#[ensures(|res| ub_checks::can_dereference(res))]
71-
pub fn to_lower_wrapper(c: char) -> [char; 3] {
72-
to_lower(c)
73-
}
74-
}
75-
76-
#[kani::proof_for_contract(to_upper_wrapper)]
40+
/// Checks that `to_upper` does not trigger UB or panics for all valid characters.
41+
#[kani::proof]
7742
fn check_to_upper_safety() {
78-
let _ = to_upper_wrapper(kani::any());
43+
let _ = to_upper(kani::any());
7944
}
8045

81-
#[kani::proof_for_contract(to_lower_wrapper)]
46+
/// Checks that `to_lower` does not trigger UB or panics for all valid characters.
47+
#[kani::proof]
8248
fn check_to_lower_safety() {
83-
let _ = to_lower_wrapper(kani::any());
49+
let _ = to_lower(kani::any());
8450
}
8551
}

0 commit comments

Comments
 (0)