Skip to content

Commit 9e62272

Browse files
authored
updated/added comments to slice/mod.rs
1 parent c2a64d8 commit 9e62272

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

library/core/src/slice/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4025,8 +4025,8 @@ impl<T> [T] {
40254025
}
40264026
}
40274027
)]
4028-
//The following two ensures clauses guarantee that middle is of maximum size within self
4029-
//If U or T are ZST, then middle has size zero, so we adapt the check in that case
4028+
//The following clause guarantees that middle is of maximum size within self
4029+
//If U or T are ZSTs, then middle has size zero, so we adapt the check in that case
40304030
#[ensures(|(prefix, _, suffix): &(&[T], &[U], &[T])|
40314031
((U::IS_ZST || T::IS_ZST) && prefix.len() == self.len()) || (
40324032
(prefix.len() * size_of::<T>() < align_of::<U>()) &&
@@ -4170,8 +4170,8 @@ impl<T> [T] {
41704170
}
41714171
}
41724172
)]
4173-
//The following two ensures clauses guarantee that middle is of maximum size within self
4174-
//If U or T are ZST, then middle has size zero, so we adapt the check in that case
4173+
//The following clause guarantees that middle is of maximum size within self
4174+
//If U or T are ZSTs, then middle has size zero, so we adapt the check in that case
41754175
#[ensures(|(prefix, _, suffix): &(*const [T], *const [U], *const [T])|
41764176
((U::IS_ZST || T::IS_ZST) && prefix.len() == self.len()) || (
41774177
(prefix.len() * size_of::<T>() < align_of::<U>()) &&
@@ -5376,6 +5376,7 @@ unsafe impl GetDisjointMutIndex for range::RangeInclusive<usize> {
53765376
mod verify {
53775377
use super::*;
53785378

5379+
//generates proof_of_contract harness for align_to given the T (src) and U (dst) types
53795380
macro_rules! proof_of_contract_for_align_to {
53805381
($harness:ident, $src:ty, $dst:ty) => {
53815382
#[kani::proof_for_contract(<[$src]>::align_to)]
@@ -5388,6 +5389,7 @@ mod verify {
53885389
};
53895390
}
53905391

5392+
//generates harnesses for align_to where T is a given src type and U is one of the main primitives
53915393
macro_rules! gen_align_to_harnesses {
53925394
($mod_name:ident, $src_type:ty) => {
53935395
mod $mod_name {
@@ -5414,6 +5416,8 @@ mod verify {
54145416
gen_align_to_harnesses!(align_to_from_char, char);
54155417
gen_align_to_harnesses!(align_to_from_unit, ());
54165418

5419+
//generates proof_of_contract harness for align_to_mut given the T (src) and U (dst) types
5420+
//this uses the contract for align_to_mut_wrapper (see comment there for why)
54175421
macro_rules! proof_of_contract_for_align_to_mut {
54185422
($harness:ident, $src:ty, $dst:ty) => {
54195423
#[kani::proof_for_contract(<[$src]>::align_to_mut_wrapper)]
@@ -5426,6 +5430,7 @@ mod verify {
54265430
};
54275431
}
54285432

5433+
//generates harnesses between a given src type and all the main primitives
54295434
macro_rules! gen_align_to_mut_harnesses {
54305435
($mod_name:ident, $src_type:ty) => {
54315436
mod $mod_name {

0 commit comments

Comments
 (0)