|
76 | 76 | )]
|
77 | 77 | #![cfg_attr(not(feature = "std"), no_std)]
|
78 | 78 | #![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
79 |
| -#![cfg_attr(miri, feature(strict_provenance), feature(maybe_uninit_slice))] |
| 79 | +#![cfg_attr(miri, feature(maybe_uninit_slice))] |
80 | 80 |
|
81 | 81 | #[inline(always)]
|
82 | 82 | fn maybe_grow<R, F: FnOnce() -> R>(callback: F) -> R {
|
@@ -1381,9 +1381,10 @@ where
|
1381 | 1381 | /// let mut s = array![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
|
1382 | 1382 | /// let num = 42;
|
1383 | 1383 | /// let idx = s.partition_point(|&x| x < num);
|
1384 |
| - /// let mut s = s.into_raw_vec(); |
1385 |
| - /// s.insert(idx, num); |
1386 |
| - /// assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); |
| 1384 | + /// let (mut s, off) = s.into_raw_vec_and_offset(); |
| 1385 | + /// let off = off.unwrap_or_default(); |
| 1386 | + /// s.insert(off + idx, num); |
| 1387 | + /// assert_eq!(s[off..], [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); |
1387 | 1388 | /// ```
|
1388 | 1389 | #[must_use]
|
1389 | 1390 | fn partition_point<P>(&self, pred: P) -> usize
|
@@ -1500,9 +1501,10 @@ where
|
1500 | 1501 | /// let num = 42;
|
1501 | 1502 | /// let idx = s.partition_point(|&x| x < num);
|
1502 | 1503 | /// // The above is equivalent to `let idx = s.binary_search(&num).unwrap_or_else(|x| x);`
|
1503 |
| - /// let mut s = s.into_raw_vec(); |
1504 |
| - /// s.insert(idx, num); |
1505 |
| - /// assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); |
| 1504 | + /// let (mut s, off) = s.into_raw_vec_and_offset(); |
| 1505 | + /// let off = off.unwrap_or_default(); |
| 1506 | + /// s.insert(off + idx, num); |
| 1507 | + /// assert_eq!(s[off..], [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); |
1506 | 1508 | /// ```
|
1507 | 1509 | fn binary_search(&self, x: &A) -> Result<usize, usize>
|
1508 | 1510 | where
|
|
0 commit comments