|
50 | 50 | //! v[1] = v[1] + 5; |
51 | 51 | //! ``` |
52 | 52 | //! |
53 | | -//! [`Vec<T>`]: ../../std/vec/struct.Vec.html |
54 | | -//! [`new`]: ../../std/vec/struct.Vec.html#method.new |
55 | | -//! [`push`]: ../../std/vec/struct.Vec.html#method.push |
56 | | -//! [`Index`]: ../../std/ops/trait.Index.html |
57 | | -//! [`IndexMut`]: ../../std/ops/trait.IndexMut.html |
58 | | -//! [`vec!`]: ../../std/macro.vec.html |
| 53 | +//! [`Vec<T>`]: Vec |
| 54 | +//! [`new`]: Vec::new |
| 55 | +//! [`push`]: Vec::push |
59 | 56 |
|
60 | 57 | #![stable(feature = "rust1", since = "1.0.0")] |
61 | 58 |
|
@@ -278,22 +275,18 @@ use crate::raw_vec::RawVec; |
278 | 275 | /// `Vec` does not currently guarantee the order in which elements are dropped. |
279 | 276 | /// The order has changed in the past and may change again. |
280 | 277 | /// |
281 | | -/// [`vec!`]: ../../std/macro.vec.html |
282 | 278 | /// [`get`]: ../../std/vec/struct.Vec.html#method.get |
283 | 279 | /// [`get_mut`]: ../../std/vec/struct.Vec.html#method.get_mut |
284 | | -/// [`Index`]: ../../std/ops/trait.Index.html |
285 | | -/// [`String`]: ../../std/string/struct.String.html |
286 | | -/// [`&str`]: ../../std/primitive.str.html |
287 | | -/// [`Vec::with_capacity`]: ../../std/vec/struct.Vec.html#method.with_capacity |
288 | | -/// [`Vec::new`]: ../../std/vec/struct.Vec.html#method.new |
289 | | -/// [`shrink_to_fit`]: ../../std/vec/struct.Vec.html#method.shrink_to_fit |
290 | | -/// [`capacity`]: ../../std/vec/struct.Vec.html#method.capacity |
291 | | -/// [`mem::size_of::<T>`]: ../../std/mem/fn.size_of.html |
292 | | -/// [`len`]: ../../std/vec/struct.Vec.html#method.len |
293 | | -/// [`push`]: ../../std/vec/struct.Vec.html#method.push |
294 | | -/// [`insert`]: ../../std/vec/struct.Vec.html#method.insert |
295 | | -/// [`reserve`]: ../../std/vec/struct.Vec.html#method.reserve |
296 | | -/// [owned slice]: ../../std/boxed/struct.Box.html |
| 280 | +/// [`String`]: crate::string::String |
| 281 | +/// [`&str`]: type@str |
| 282 | +/// [`shrink_to_fit`]: Vec::shrink_to_fit |
| 283 | +/// [`capacity`]: Vec::capacity |
| 284 | +/// [`mem::size_of::<T>`]: core::mem::size_of |
| 285 | +/// [`len`]: Vec::len |
| 286 | +/// [`push`]: Vec::push |
| 287 | +/// [`insert`]: Vec::insert |
| 288 | +/// [`reserve`]: Vec::reserve |
| 289 | +/// [owned slice]: Box |
297 | 290 | #[stable(feature = "rust1", since = "1.0.0")] |
298 | 291 | #[cfg_attr(not(test), rustc_diagnostic_item = "vec_type")] |
299 | 292 | pub struct Vec<T> { |
@@ -375,7 +368,7 @@ impl<T> Vec<T> { |
375 | 368 | /// into a `Vec` with the [`from_raw_parts`] function, allowing |
376 | 369 | /// the destructor to perform the cleanup. |
377 | 370 | /// |
378 | | - /// [`from_raw_parts`]: #method.from_raw_parts |
| 371 | + /// [`from_raw_parts`]: Vec::from_raw_parts |
379 | 372 | /// |
380 | 373 | /// # Examples |
381 | 374 | /// |
@@ -430,8 +423,8 @@ impl<T> Vec<T> { |
430 | 423 | /// that nothing else uses the pointer after calling this |
431 | 424 | /// function. |
432 | 425 | /// |
433 | | - /// [`String`]: ../../std/string/struct.String.html |
434 | | - /// [`dealloc`]: ../../alloc/alloc/trait.GlobalAlloc.html#tymethod.dealloc |
| 426 | + /// [`String`]: crate::string::String |
| 427 | + /// [`dealloc`]: crate::alloc::GlobalAlloc::dealloc |
435 | 428 | /// |
436 | 429 | /// # Examples |
437 | 430 | /// |
@@ -661,7 +654,7 @@ impl<T> Vec<T> { |
661 | 654 | /// |
662 | 655 | /// Note that this will drop any excess capacity. |
663 | 656 | /// |
664 | | - /// [owned slice]: ../../std/boxed/struct.Box.html |
| 657 | + /// [owned slice]: Box |
665 | 658 | /// |
666 | 659 | /// # Examples |
667 | 660 | /// |
@@ -732,8 +725,8 @@ impl<T> Vec<T> { |
732 | 725 | /// assert_eq!(vec, []); |
733 | 726 | /// ``` |
734 | 727 | /// |
735 | | - /// [`clear`]: #method.clear |
736 | | - /// [`drain`]: #method.drain |
| 728 | + /// [`clear`]: Vec::clear |
| 729 | + /// [`drain`]: Vec::drain |
737 | 730 | #[stable(feature = "rust1", since = "1.0.0")] |
738 | 731 | pub fn truncate(&mut self, len: usize) { |
739 | 732 | // This is safe because: |
@@ -812,7 +805,7 @@ impl<T> Vec<T> { |
812 | 805 | /// } |
813 | 806 | /// ``` |
814 | 807 | /// |
815 | | - /// [`as_mut_ptr`]: #method.as_mut_ptr |
| 808 | + /// [`as_mut_ptr`]: Vec::as_mut_ptr |
816 | 809 | #[stable(feature = "vec_as_ptr", since = "1.37.0")] |
817 | 810 | #[inline] |
818 | 811 | pub fn as_ptr(&self) -> *const T { |
@@ -868,17 +861,17 @@ impl<T> Vec<T> { |
868 | 861 | /// is done using one of the safe operations instead, such as |
869 | 862 | /// [`truncate`], [`resize`], [`extend`], or [`clear`]. |
870 | 863 | /// |
871 | | - /// [`truncate`]: #method.truncate |
872 | | - /// [`resize`]: #method.resize |
873 | | - /// [`extend`]: ../../std/iter/trait.Extend.html#tymethod.extend |
874 | | - /// [`clear`]: #method.clear |
| 864 | + /// [`truncate`]: Vec::truncate |
| 865 | + /// [`resize`]: Vec::resize |
| 866 | + /// [`extend`]: Extend::extend |
| 867 | + /// [`clear`]: Vec::clear |
875 | 868 | /// |
876 | 869 | /// # Safety |
877 | 870 | /// |
878 | 871 | /// - `new_len` must be less than or equal to [`capacity()`]. |
879 | 872 | /// - The elements at `old_len..new_len` must be initialized. |
880 | 873 | /// |
881 | | - /// [`capacity()`]: #method.capacity |
| 874 | + /// [`capacity()`]: Vec::capacity |
882 | 875 | /// |
883 | 876 | /// # Examples |
884 | 877 | /// |
@@ -1217,8 +1210,6 @@ impl<T> Vec<T> { |
1217 | 1210 | /// Removes the last element from a vector and returns it, or [`None`] if it |
1218 | 1211 | /// is empty. |
1219 | 1212 | /// |
1220 | | - /// [`None`]: ../../std/option/enum.Option.html#variant.None |
1221 | | - /// |
1222 | 1213 | /// # Examples |
1223 | 1214 | /// |
1224 | 1215 | /// ``` |
@@ -1482,8 +1473,7 @@ impl<T> Vec<T> { |
1482 | 1473 | /// assert_eq!(vec, [2, 4, 8, 16]); |
1483 | 1474 | /// ``` |
1484 | 1475 | /// |
1485 | | - /// [`resize`]: #method.resize |
1486 | | - /// [`Clone`]: ../../std/clone/trait.Clone.html |
| 1476 | + /// [`resize`]: Vec::resize |
1487 | 1477 | #[stable(feature = "vec_resize_with", since = "1.33.0")] |
1488 | 1478 | pub fn resize_with<F>(&mut self, new_len: usize, f: F) |
1489 | 1479 | where |
@@ -1534,7 +1524,7 @@ impl<T> Vec<T> { |
1534 | 1524 | /// reading from a file) before marking the data as initialized using the |
1535 | 1525 | /// [`set_len`] method. |
1536 | 1526 | /// |
1537 | | - /// [`set_len`]: #method.set_len |
| 1527 | + /// [`set_len`]: Vec::set_len |
1538 | 1528 | /// |
1539 | 1529 | /// # Examples |
1540 | 1530 | /// |
@@ -1593,9 +1583,7 @@ impl<T: Clone> Vec<T> { |
1593 | 1583 | /// assert_eq!(vec, [1, 2]); |
1594 | 1584 | /// ``` |
1595 | 1585 | /// |
1596 | | - /// [`Clone`]: ../../std/clone/trait.Clone.html |
1597 | | - /// [`Default`]: ../../std/default/trait.Default.html |
1598 | | - /// [`resize_with`]: #method.resize_with |
| 1586 | + /// [`resize_with`]: Vec::resize_with |
1599 | 1587 | #[stable(feature = "vec_resize", since = "1.5.0")] |
1600 | 1588 | pub fn resize(&mut self, new_len: usize, value: T) { |
1601 | 1589 | let len = self.len(); |
@@ -1657,10 +1645,7 @@ impl<T: Default> Vec<T> { |
1657 | 1645 | /// assert_eq!(vec, [1, 2]); |
1658 | 1646 | /// ``` |
1659 | 1647 | /// |
1660 | | - /// [`resize`]: #method.resize |
1661 | | - /// [`Default::default()`]: ../../std/default/trait.Default.html#tymethod.default |
1662 | | - /// [`Default`]: ../../std/default/trait.Default.html |
1663 | | - /// [`Clone`]: ../../std/clone/trait.Clone.html |
| 1648 | + /// [`resize`]: Vec::resize |
1664 | 1649 | #[unstable(feature = "vec_resize_default", issue = "41758")] |
1665 | 1650 | #[rustc_deprecated( |
1666 | 1651 | reason = "This is moving towards being removed in favor \ |
@@ -2341,7 +2326,6 @@ impl<T> Vec<T> { |
2341 | 2326 | /// Note that `drain_filter` also lets you mutate every element in the filter closure, |
2342 | 2327 | /// regardless of whether you choose to keep or remove it. |
2343 | 2328 | /// |
2344 | | - /// |
2345 | 2329 | /// # Examples |
2346 | 2330 | /// |
2347 | 2331 | /// Splitting an array into evens and odds, reusing the original allocation: |
|
0 commit comments