Skip to content

Commit 470ed70

Browse files
authored
Rollup merge of #86852 - Amanieu:remove_doc_aliases, r=joshtriplett
Remove some doc aliases As per the new doc alias policy in rust-lang/std-dev-guide#25, this removes some controversial doc aliases: - `malloc`, `alloc`, `realloc`, etc. - `length` (alias for `len`) - `delete` (alias for `remove` in collections and also file/directory deletion) r? `@joshtriplett`
2 parents 2bc7d4d + e2536bb commit 470ed70

File tree

16 files changed

+0
-34
lines changed

16 files changed

+0
-34
lines changed

library/alloc/src/boxed.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ impl<T> Box<T> {
187187
/// ```
188188
#[cfg(not(no_global_oom_handling))]
189189
#[inline(always)]
190-
#[doc(alias = "alloc")]
191-
#[doc(alias = "malloc")]
192190
#[stable(feature = "rust1", since = "1.0.0")]
193191
pub fn new(x: T) -> Self {
194192
box x
@@ -239,7 +237,6 @@ impl<T> Box<T> {
239237
/// [zeroed]: mem::MaybeUninit::zeroed
240238
#[cfg(not(no_global_oom_handling))]
241239
#[inline]
242-
#[doc(alias = "calloc")]
243240
#[unstable(feature = "new_uninit", issue = "63291")]
244241
pub fn new_zeroed() -> Box<mem::MaybeUninit<T>> {
245242
Self::new_zeroed_in(Global)

library/alloc/src/collections/binary_heap.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,6 @@ impl<T> BinaryHeap<T> {
10341034
///
10351035
/// assert_eq!(heap.len(), 2);
10361036
/// ```
1037-
#[doc(alias = "length")]
10381037
#[stable(feature = "rust1", since = "1.0.0")]
10391038
pub fn len(&self) -> usize {
10401039
self.data.len()

library/alloc/src/collections/btree/map.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,6 @@ impl<K, V> BTreeMap<K, V> {
889889
/// assert_eq!(map.remove(&1), Some("a"));
890890
/// assert_eq!(map.remove(&1), None);
891891
/// ```
892-
#[doc(alias = "delete")]
893892
#[stable(feature = "rust1", since = "1.0.0")]
894893
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V>
895894
where
@@ -2165,7 +2164,6 @@ impl<K, V> BTreeMap<K, V> {
21652164
/// a.insert(1, "a");
21662165
/// assert_eq!(a.len(), 1);
21672166
/// ```
2168-
#[doc(alias = "length")]
21692167
#[stable(feature = "rust1", since = "1.0.0")]
21702168
#[rustc_const_unstable(feature = "const_btree_new", issue = "71835")]
21712169
pub const fn len(&self) -> usize {

library/alloc/src/collections/btree/set.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,6 @@ impl<T> BTreeSet<T> {
810810
/// assert_eq!(set.remove(&2), true);
811811
/// assert_eq!(set.remove(&2), false);
812812
/// ```
813-
#[doc(alias = "delete")]
814813
#[stable(feature = "rust1", since = "1.0.0")]
815814
pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool
816815
where
@@ -1021,7 +1020,6 @@ impl<T> BTreeSet<T> {
10211020
/// v.insert(1);
10221021
/// assert_eq!(v.len(), 1);
10231022
/// ```
1024-
#[doc(alias = "length")]
10251023
#[stable(feature = "rust1", since = "1.0.0")]
10261024
#[rustc_const_unstable(feature = "const_btree_new", issue = "71835")]
10271025
pub const fn len(&self) -> usize {

library/alloc/src/collections/linked_list.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,6 @@ impl<T> LinkedList<T> {
586586
/// dl.push_back(3);
587587
/// assert_eq!(dl.len(), 3);
588588
/// ```
589-
#[doc(alias = "length")]
590589
#[inline]
591590
#[stable(feature = "rust1", since = "1.0.0")]
592591
pub fn len(&self) -> usize {

library/alloc/src/collections/vec_deque/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,6 @@ impl<T> VecDeque<T> {
10361036
/// v.push_back(1);
10371037
/// assert_eq!(v.len(), 1);
10381038
/// ```
1039-
#[doc(alias = "length")]
10401039
#[stable(feature = "rust1", since = "1.0.0")]
10411040
pub fn len(&self) -> usize {
10421041
count(self.tail, self.head, self.cap())

library/alloc/src/macros.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
///
3636
/// [`Vec`]: crate::vec::Vec
3737
#[cfg(not(test))]
38-
#[doc(alias = "alloc")]
39-
#[doc(alias = "malloc")]
4038
#[macro_export]
4139
#[stable(feature = "rust1", since = "1.0.0")]
4240
#[allow_internal_unstable(box_syntax, liballoc_internals)]

library/alloc/src/string.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,6 @@ impl String {
419419
/// ```
420420
#[cfg(not(no_global_oom_handling))]
421421
#[inline]
422-
#[doc(alias = "alloc")]
423-
#[doc(alias = "malloc")]
424422
#[stable(feature = "rust1", since = "1.0.0")]
425423
pub fn with_capacity(capacity: usize) -> String {
426424
String { vec: Vec::with_capacity(capacity) }
@@ -1534,7 +1532,6 @@ impl String {
15341532
/// assert_eq!(fancy_f.len(), 4);
15351533
/// assert_eq!(fancy_f.chars().count(), 3);
15361534
/// ```
1537-
#[doc(alias = "length")]
15381535
#[inline]
15391536
#[stable(feature = "rust1", since = "1.0.0")]
15401537
pub fn len(&self) -> usize {

library/alloc/src/vec/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ impl<T> Vec<T> {
459459
/// ```
460460
#[cfg(not(no_global_oom_handling))]
461461
#[inline]
462-
#[doc(alias = "malloc")]
463462
#[stable(feature = "rust1", since = "1.0.0")]
464463
pub fn with_capacity(capacity: usize) -> Self {
465464
Self::with_capacity_in(capacity, Global)
@@ -799,7 +798,6 @@ impl<T, A: Allocator> Vec<T, A> {
799798
/// assert!(vec.capacity() >= 11);
800799
/// ```
801800
#[cfg(not(no_global_oom_handling))]
802-
#[doc(alias = "realloc")]
803801
#[stable(feature = "rust1", since = "1.0.0")]
804802
pub fn reserve(&mut self, additional: usize) {
805803
self.buf.reserve(self.len, additional);
@@ -826,7 +824,6 @@ impl<T, A: Allocator> Vec<T, A> {
826824
/// assert!(vec.capacity() >= 11);
827825
/// ```
828826
#[cfg(not(no_global_oom_handling))]
829-
#[doc(alias = "realloc")]
830827
#[stable(feature = "rust1", since = "1.0.0")]
831828
pub fn reserve_exact(&mut self, additional: usize) {
832829
self.buf.reserve_exact(self.len, additional);
@@ -864,7 +861,6 @@ impl<T, A: Allocator> Vec<T, A> {
864861
/// }
865862
/// # process_data(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");
866863
/// ```
867-
#[doc(alias = "realloc")]
868864
#[unstable(feature = "try_reserve", reason = "new API", issue = "48043")]
869865
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
870866
self.buf.try_reserve(self.len, additional)
@@ -906,7 +902,6 @@ impl<T, A: Allocator> Vec<T, A> {
906902
/// }
907903
/// # process_data(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");
908904
/// ```
909-
#[doc(alias = "realloc")]
910905
#[unstable(feature = "try_reserve", reason = "new API", issue = "48043")]
911906
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
912907
self.buf.try_reserve_exact(self.len, additional)
@@ -927,7 +922,6 @@ impl<T, A: Allocator> Vec<T, A> {
927922
/// assert!(vec.capacity() >= 3);
928923
/// ```
929924
#[cfg(not(no_global_oom_handling))]
930-
#[doc(alias = "realloc")]
931925
#[stable(feature = "rust1", since = "1.0.0")]
932926
pub fn shrink_to_fit(&mut self) {
933927
// The capacity is never less than the length, and there's nothing to do when
@@ -958,7 +952,6 @@ impl<T, A: Allocator> Vec<T, A> {
958952
/// assert!(vec.capacity() >= 3);
959953
/// ```
960954
#[cfg(not(no_global_oom_handling))]
961-
#[doc(alias = "realloc")]
962955
#[unstable(feature = "shrink_to", reason = "new API", issue = "56431")]
963956
pub fn shrink_to(&mut self, min_capacity: usize) {
964957
if self.capacity() > min_capacity {
@@ -1820,7 +1813,6 @@ impl<T, A: Allocator> Vec<T, A> {
18201813
/// let a = vec![1, 2, 3];
18211814
/// assert_eq!(a.len(), 3);
18221815
/// ```
1823-
#[doc(alias = "length")]
18241816
#[inline]
18251817
#[stable(feature = "rust1", since = "1.0.0")]
18261818
pub fn len(&self) -> usize {

library/core/src/iter/traits/exact_size.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ pub trait ExactSizeIterator: Iterator {
9797
///
9898
/// assert_eq!(5, five.len());
9999
/// ```
100-
#[doc(alias = "length")]
101100
#[inline]
102101
#[stable(feature = "rust1", since = "1.0.0")]
103102
fn len(&self) -> usize {

0 commit comments

Comments
 (0)