Skip to content

Commit 30e3f1a

Browse files
Add more doc aliases
1 parent 38e251b commit 30e3f1a

File tree

5 files changed

+33
-0
lines changed

5 files changed

+33
-0
lines changed

src/libcore/cmp.rs

+12
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ use self::Ordering::*;
106106
/// ```
107107
#[lang = "eq"]
108108
#[stable(feature = "rust1", since = "1.0.0")]
109+
#[doc(alias = "==")]
110+
#[doc(alias = "!=")]
109111
#[rustc_on_unimplemented = "can't compare `{Self}` with `{Rhs}`"]
110112
pub trait PartialEq<Rhs: ?Sized = Self> {
111113
/// This method tests for `self` and `other` values to be equal, and is used
@@ -160,6 +162,8 @@ pub trait PartialEq<Rhs: ?Sized = Self> {
160162
/// }
161163
/// impl Eq for Book {}
162164
/// ```
165+
#[doc(alias = "==")]
166+
#[doc(alias = "!=")]
163167
#[stable(feature = "rust1", since = "1.0.0")]
164168
pub trait Eq: PartialEq<Self> {
165169
// this method is used solely by #[deriving] to assert
@@ -428,6 +432,10 @@ impl<T: Ord> Ord for Reverse<T> {
428432
/// }
429433
/// ```
430434
#[lang = "ord"]
435+
#[doc(alias = "<")]
436+
#[doc(alias = ">")]
437+
#[doc(alias = "<=")]
438+
#[doc(alias = ">=")]
431439
#[stable(feature = "rust1", since = "1.0.0")]
432440
pub trait Ord: Eq + PartialOrd<Self> {
433441
/// This method returns an `Ordering` between `self` and `other`.
@@ -599,6 +607,10 @@ impl PartialOrd for Ordering {
599607
/// ```
600608
#[lang = "partial_ord"]
601609
#[stable(feature = "rust1", since = "1.0.0")]
610+
#[doc(alias = ">")]
611+
#[doc(alias = "<")]
612+
#[doc(alias = "<=")]
613+
#[doc(alias = ">=")]
602614
#[rustc_on_unimplemented = "can't compare `{Self}` with `{Rhs}`"]
603615
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
604616
/// This method returns an ordering between `self` and `other` values if one exists.

src/libcore/fmt/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ impl<'a> Display for Arguments<'a> {
547547
message="`{Self}` doesn't implement `{Debug}`",
548548
label="`{Self}` cannot be formatted using `:?` because it doesn't implement `{Debug}`",
549549
)]
550+
#[doc(alias = "{:?}")]
550551
#[lang = "debug_trait"]
551552
pub trait Debug {
552553
/// Formats the value using the given formatter.
@@ -612,6 +613,7 @@ pub trait Debug {
612613
label="`{Self}` cannot be formatted with the default formatter; \
613614
try using `:?` instead if you are using a format string",
614615
)]
616+
#[doc(alias = "{}")]
615617
#[stable(feature = "rust1", since = "1.0.0")]
616618
pub trait Display {
617619
/// Formats the value using the given formatter.

src/libcore/ops/bit.rs

+10
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ not_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
119119
/// assert_eq!(bv1 & bv2, expected);
120120
/// ```
121121
#[lang = "bitand"]
122+
#[doc(alias = "&")]
122123
#[stable(feature = "rust1", since = "1.0.0")]
123124
#[rustc_on_unimplemented(message="no implementation for `{Self} & {RHS}`",
124125
label="no implementation for `{Self} & {RHS}`")]
@@ -201,6 +202,7 @@ bitand_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
201202
/// assert_eq!(bv1 | bv2, expected);
202203
/// ```
203204
#[lang = "bitor"]
205+
#[doc(alias = "|")]
204206
#[stable(feature = "rust1", since = "1.0.0")]
205207
#[rustc_on_unimplemented(message="no implementation for `{Self} | {RHS}`",
206208
label="no implementation for `{Self} | {RHS}`")]
@@ -286,6 +288,7 @@ bitor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
286288
/// assert_eq!(bv1 ^ bv2, expected);
287289
/// ```
288290
#[lang = "bitxor"]
291+
#[doc(alias = "^")]
289292
#[stable(feature = "rust1", since = "1.0.0")]
290293
#[rustc_on_unimplemented(message="no implementation for `{Self} ^ {RHS}`",
291294
label="no implementation for `{Self} ^ {RHS}`")]
@@ -372,6 +375,7 @@ bitxor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
372375
/// SpinVector { vec: vec![2, 3, 4, 0, 1] });
373376
/// ```
374377
#[lang = "shl"]
378+
#[doc(alias = "<<")]
375379
#[stable(feature = "rust1", since = "1.0.0")]
376380
#[rustc_on_unimplemented(message="no implementation for `{Self} << {RHS}`",
377381
label="no implementation for `{Self} << {RHS}`")]
@@ -479,6 +483,7 @@ shl_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 isize i128 }
479483
/// SpinVector { vec: vec![3, 4, 0, 1, 2] });
480484
/// ```
481485
#[lang = "shr"]
486+
#[doc(alias = ">>")]
482487
#[stable(feature = "rust1", since = "1.0.0")]
483488
#[rustc_on_unimplemented(message="no implementation for `{Self} >> {RHS}`",
484489
label="no implementation for `{Self} >> {RHS}`")]
@@ -593,6 +598,7 @@ shr_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
593598
/// assert_eq!(bv, expected);
594599
/// ```
595600
#[lang = "bitand_assign"]
601+
#[doc(alias = "&=")]
596602
#[stable(feature = "op_assign_traits", since = "1.8.0")]
597603
#[rustc_on_unimplemented(message="no implementation for `{Self} &= {Rhs}`",
598604
label="no implementation for `{Self} &= {Rhs}`")]
@@ -641,6 +647,7 @@ bitand_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
641647
/// assert_eq!(prefs, PersonalPreferences { likes_cats: true, likes_dogs: true });
642648
/// ```
643649
#[lang = "bitor_assign"]
650+
#[doc(alias = "|=")]
644651
#[stable(feature = "op_assign_traits", since = "1.8.0")]
645652
#[rustc_on_unimplemented(message="no implementation for `{Self} |= {Rhs}`",
646653
label="no implementation for `{Self} |= {Rhs}`")]
@@ -689,6 +696,7 @@ bitor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
689696
/// assert_eq!(personality, Personality { has_soul: true, likes_knitting: false});
690697
/// ```
691698
#[lang = "bitxor_assign"]
699+
#[doc(alias = "^=")]
692700
#[stable(feature = "op_assign_traits", since = "1.8.0")]
693701
#[rustc_on_unimplemented(message="no implementation for `{Self} ^= {Rhs}`",
694702
label="no implementation for `{Self} ^= {Rhs}`")]
@@ -735,6 +743,7 @@ bitxor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
735743
/// assert_eq!(scalar, Scalar(16));
736744
/// ```
737745
#[lang = "shl_assign"]
746+
#[doc(alias = "<<=")]
738747
#[stable(feature = "op_assign_traits", since = "1.8.0")]
739748
#[rustc_on_unimplemented(message="no implementation for `{Self} <<= {Rhs}`",
740749
label="no implementation for `{Self} <<= {Rhs}`")]
@@ -802,6 +811,7 @@ shl_assign_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
802811
/// assert_eq!(scalar, Scalar(4));
803812
/// ```
804813
#[lang = "shr_assign"]
814+
#[doc(alias = ">>=")]
805815
#[stable(feature = "op_assign_traits", since = "1.8.0")]
806816
#[rustc_on_unimplemented(message="no implementation for `{Self} >>= {Rhs}`",
807817
label="no implementation for `{Self} >>= {Rhs}`")]

src/libcore/ops/deref.rs

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
/// assert_eq!('a', *x);
6969
/// ```
7070
#[lang = "deref"]
71+
#[doc(alias = "*")]
72+
#[doc(alias = "&*")]
7173
#[stable(feature = "rust1", since = "1.0.0")]
7274
pub trait Deref {
7375
/// The resulting type after dereferencing.
@@ -162,6 +164,7 @@ impl<'a, T: ?Sized> Deref for &'a mut T {
162164
/// assert_eq!('b', *x);
163165
/// ```
164166
#[lang = "deref_mut"]
167+
#[doc(alias = "*")]
165168
#[stable(feature = "rust1", since = "1.0.0")]
166169
pub trait DerefMut: Deref {
167170
/// Mutably dereferences the value.

src/libcore/ops/range.rs

+6
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ use fmt;
4545
/// [`IntoIterator`]: ../iter/trait.Iterator.html
4646
/// [`Iterator`]: ../iter/trait.IntoIterator.html
4747
/// [slicing index]: ../slice/trait.SliceIndex.html
48+
#[doc(alias = "..")]
4849
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
4950
#[stable(feature = "rust1", since = "1.0.0")]
5051
pub struct RangeFull;
@@ -74,6 +75,7 @@ impl fmt::Debug for RangeFull {
7475
/// assert_eq!(arr[1.. ], [ 'b', 'c', 'd']);
7576
/// assert_eq!(arr[1..3], [ 'b', 'c' ]); // Range
7677
/// ```
78+
#[doc(alias = "..")]
7779
#[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186
7880
#[stable(feature = "rust1", since = "1.0.0")]
7981
pub struct Range<Idx> {
@@ -175,6 +177,7 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
175177
/// ```
176178
///
177179
/// [`Iterator`]: ../iter/trait.IntoIterator.html
180+
#[doc(alias = "..")]
178181
#[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186
179182
#[stable(feature = "rust1", since = "1.0.0")]
180183
pub struct RangeFrom<Idx> {
@@ -256,6 +259,7 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
256259
/// [`IntoIterator`]: ../iter/trait.Iterator.html
257260
/// [`Iterator`]: ../iter/trait.IntoIterator.html
258261
/// [slicing index]: ../slice/trait.SliceIndex.html
262+
#[doc(alias = "..")]
259263
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
260264
#[stable(feature = "rust1", since = "1.0.0")]
261265
pub struct RangeTo<Idx> {
@@ -323,6 +327,7 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
323327
/// assert_eq!(arr[ ..=2], [0,1,2 ]);
324328
/// assert_eq!(arr[1..=2], [ 1,2 ]); // RangeInclusive
325329
/// ```
330+
#[doc(alias = "..=")]
326331
#[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186
327332
#[stable(feature = "inclusive_range", since = "1.26.0")]
328333
pub struct RangeInclusive<Idx> {
@@ -449,6 +454,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
449454
/// [`IntoIterator`]: ../iter/trait.Iterator.html
450455
/// [`Iterator`]: ../iter/trait.IntoIterator.html
451456
/// [slicing index]: ../slice/trait.SliceIndex.html
457+
#[doc(alias = "..=")]
452458
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
453459
#[stable(feature = "inclusive_range", since = "1.26.0")]
454460
pub struct RangeToInclusive<Idx> {

0 commit comments

Comments
 (0)