@@ -4026,6 +4026,11 @@ impl<T> [T] {
40264026 }
40274027 ) ]
40284028 //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
4030+ #[ ensures( |( prefix, _, suffix) : & ( & [ T ] , & [ U ] , & [ T ] ) |
4031+ ( ( U :: IS_ZST || T :: IS_ZST ) && prefix. len( ) == self . len( ) ) || ( ( prefix. len( ) * size_of:: <T >( ) < align_of:: <U >( ) ) &&
4032+ ( suffix. len( ) * size_of:: <T >( ) < size_of:: <U >( ) ) )
4033+ ) ]
40294034 #[ ensures( |( prefix, _, _) : & ( & [ T ] , & [ U ] , & [ T ] ) | prefix. len( ) * size_of:: <T >( ) < align_of:: <U >( ) ) ]
40304035 #[ ensures( |( _, _, suffix) : & ( & [ T ] , & [ U ] , & [ T ] ) | suffix. len( ) * size_of:: <T >( ) < size_of:: <U >( ) ) ]
40314036 //Either align_to just returns self in the prefix, or the 3 returned slices
@@ -4166,9 +4171,12 @@ impl<T> [T] {
41664171 }
41674172 ) ]
41684173 //The following two ensures clauses guarantee that middle is of maximum size within self
4169- #[ ensures( |( prefix, _, _) : & ( * const [ T ] , * const [ U ] , * const [ T ] ) | prefix. len( ) * size_of:: <T >( )
4170- < align_of:: <U >( ) ) ]
4171- #[ ensures( |( _, _, suffix) : & ( * const [ T ] , * const [ U ] , * const [ T ] ) | suffix. len( ) * size_of:: <T >( ) < size_of:: <U >( ) ) ]
4174+ //If U or T are ZST, then middle has size zero, so we adapt the check in that case
4175+ #[ ensures( |( prefix, _, suffix) : & ( & [ T ] , & [ U ] , & [ T ] ) |
4176+ ( ( U :: IS_ZST || T :: IS_ZST ) && prefix. len( ) == self . len( ) ) ||
4177+ ( ( prefix. len( ) * size_of:: <T >( ) < align_of:: <U >( ) ) &&
4178+ ( suffix. len( ) * size_of:: <T >( ) < size_of:: <U >( ) ) )
4179+ ) ]
41724180 //Either align_to just returns self in the prefix, or the 3 returned slices
41734181 //should be sequential, contiguous, and have same total length as self
41744182 #[ ensures( |( prefix, middle, suffix) : & ( * const [ T ] , * const [ U ] , * const [ T ] ) |
0 commit comments