@@ -148,9 +148,9 @@ impl<T> VecDeque<T> {
148
148
/// Copies a contiguous block of memory len long from src to dst
149
149
#[ inline]
150
150
unsafe fn copy ( & self , dst : usize , src : usize , len : usize ) {
151
- debug_assert ! ( dst + len <= self . cap( ) , "dst={} src={} len={} cap={}" , dst, src, len,
151
+ debug_assert ! ( dst + len <= self . cap( ) , "cpy dst={} src={} len={} cap={}" , dst, src, len,
152
152
self . cap( ) ) ;
153
- debug_assert ! ( src + len <= self . cap( ) , "dst={} src={} len={} cap={}" , dst, src, len,
153
+ debug_assert ! ( src + len <= self . cap( ) , "cpy dst={} src={} len={} cap={}" , dst, src, len,
154
154
self . cap( ) ) ;
155
155
ptr:: copy (
156
156
self . ptr ( ) . offset ( src as isize ) ,
@@ -161,9 +161,9 @@ impl<T> VecDeque<T> {
161
161
/// Copies a contiguous block of memory len long from src to dst
162
162
#[ inline]
163
163
unsafe fn copy_nonoverlapping ( & self , dst : usize , src : usize , len : usize ) {
164
- debug_assert ! ( dst + len <= self . cap( ) , "dst={} src={} len={} cap={}" , dst, src, len,
164
+ debug_assert ! ( dst + len <= self . cap( ) , "cno dst={} src={} len={} cap={}" , dst, src, len,
165
165
self . cap( ) ) ;
166
- debug_assert ! ( src + len <= self . cap( ) , "dst={} src={} len={} cap={}" , dst, src, len,
166
+ debug_assert ! ( src + len <= self . cap( ) , "cno dst={} src={} len={} cap={}" , dst, src, len,
167
167
self . cap( ) ) ;
168
168
ptr:: copy_nonoverlapping (
169
169
self . ptr ( ) . offset ( src as isize ) ,
@@ -175,9 +175,11 @@ impl<T> VecDeque<T> {
175
175
/// (abs(dst - src) + len) must be no larger than cap() (There must be at
176
176
/// most one continuous overlapping region between src and dest).
177
177
unsafe fn wrap_copy ( & self , dst : usize , src : usize , len : usize ) {
178
- debug_assert ! (
179
- ( if src <= dst { dst - src } else { src - dst } ) + len <= self . cap( ) ,
180
- "dst={} src={} len={} cap={}" , dst, src, len, self . cap( ) ) ;
178
+ #[ allow( dead_code) ]
179
+ fn diff ( a : usize , b : usize ) -> usize { if a <= b { b - a} else { a - b} }
180
+ debug_assert ! ( cmp:: min( diff( dst, src) ,
181
+ self . cap( ) - diff( dst, src) ) + len <= self . cap( ) ,
182
+ "wrc dst={} src={} len={} cap={}" , dst, src, len, self . cap( ) ) ;
181
183
182
184
if src == dst || len == 0 { return }
183
185
0 commit comments