Skip to content

Commit 84b91d6

Browse files
add more aliases
1 parent 03b0856 commit 84b91d6

File tree

6 files changed

+32
-0
lines changed

6 files changed

+32
-0
lines changed

src/libcore/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
#![feature(unboxed_closures)]
9999
#![feature(untagged_unions)]
100100
#![feature(unwind_attributes)]
101+
#![feature(doc_alias)]
101102

102103
#![cfg_attr(not(stage0), feature(mmx_target_feature))]
103104
#![cfg_attr(not(stage0), feature(tbm_target_feature))]

src/libcore/macros.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ macro_rules! debug_assert_ne {
295295
/// ```
296296
#[macro_export]
297297
#[stable(feature = "rust1", since = "1.0.0")]
298+
#[doc(alias = "?")]
298299
macro_rules! try {
299300
($expr:expr) => (match $expr {
300301
$crate::result::Result::Ok(val) => val,

src/libcore/ops/arith.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
message="cannot add `{RHS}` to `{Self}`",
8888
label="no implementation for `{Self} + {RHS}`",
8989
)]
90+
#[doc(alias = "+")]
9091
pub trait Add<RHS=Self> {
9192
/// The resulting type after applying the `+` operator.
9293
#[stable(feature = "rust1", since = "1.0.0")]
@@ -183,6 +184,7 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
183184
#[stable(feature = "rust1", since = "1.0.0")]
184185
#[rustc_on_unimplemented(message="cannot subtract `{RHS}` from `{Self}`",
185186
label="no implementation for `{Self} - {RHS}`")]
187+
#[doc(alias = "-")]
186188
pub trait Sub<RHS=Self> {
187189
/// The resulting type after applying the `-` operator.
188190
#[stable(feature = "rust1", since = "1.0.0")]
@@ -301,6 +303,7 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
301303
#[stable(feature = "rust1", since = "1.0.0")]
302304
#[rustc_on_unimplemented(message="cannot multiply `{RHS}` to `{Self}`",
303305
label="no implementation for `{Self} * {RHS}`")]
306+
#[doc(alias = "*")]
304307
pub trait Mul<RHS=Self> {
305308
/// The resulting type after applying the `*` operator.
306309
#[stable(feature = "rust1", since = "1.0.0")]
@@ -423,6 +426,7 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
423426
#[stable(feature = "rust1", since = "1.0.0")]
424427
#[rustc_on_unimplemented(message="cannot divide `{Self}` by `{RHS}`",
425428
label="no implementation for `{Self} / {RHS}`")]
429+
#[doc(alias = "/")]
426430
pub trait Div<RHS=Self> {
427431
/// The resulting type after applying the `/` operator.
428432
#[stable(feature = "rust1", since = "1.0.0")]
@@ -506,6 +510,7 @@ div_impl_float! { f32 f64 }
506510
#[stable(feature = "rust1", since = "1.0.0")]
507511
#[rustc_on_unimplemented(message="cannot mod `{Self}` by `{RHS}`",
508512
label="no implementation for `{Self} % {RHS}`")]
513+
#[doc(alias = "%")]
509514
pub trait Rem<RHS=Self> {
510515
/// The resulting type after applying the `%` operator.
511516
#[stable(feature = "rust1", since = "1.0.0")]
@@ -589,6 +594,7 @@ rem_impl_float! { f32 f64 }
589594
/// ```
590595
#[lang = "neg"]
591596
#[stable(feature = "rust1", since = "1.0.0")]
597+
#[doc(alias = "-")]
592598
pub trait Neg {
593599
/// The resulting type after applying the `-` operator.
594600
#[stable(feature = "rust1", since = "1.0.0")]
@@ -664,6 +670,8 @@ neg_impl_numeric! { isize i8 i16 i32 i64 i128 f32 f64 }
664670
#[stable(feature = "op_assign_traits", since = "1.8.0")]
665671
#[rustc_on_unimplemented(message="cannot add-assign `{Rhs}` to `{Self}`",
666672
label="no implementation for `{Self} += {Rhs}`")]
673+
#[doc(alias = "+")]
674+
#[doc(alias = "+=")]
667675
pub trait AddAssign<Rhs=Self> {
668676
/// Performs the `+=` operation.
669677
#[stable(feature = "op_assign_traits", since = "1.8.0")]
@@ -718,6 +726,8 @@ add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
718726
#[stable(feature = "op_assign_traits", since = "1.8.0")]
719727
#[rustc_on_unimplemented(message="cannot subtract-assign `{Rhs}` from `{Self}`",
720728
label="no implementation for `{Self} -= {Rhs}`")]
729+
#[doc(alias = "-")]
730+
#[doc(alias = "-=")]
721731
pub trait SubAssign<Rhs=Self> {
722732
/// Performs the `-=` operation.
723733
#[stable(feature = "op_assign_traits", since = "1.8.0")]
@@ -763,6 +773,8 @@ sub_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
763773
#[stable(feature = "op_assign_traits", since = "1.8.0")]
764774
#[rustc_on_unimplemented(message="cannot multiply-assign `{Rhs}` to `{Self}`",
765775
label="no implementation for `{Self} *= {Rhs}`")]
776+
#[doc(alias = "*")]
777+
#[doc(alias = "*=")]
766778
pub trait MulAssign<Rhs=Self> {
767779
/// Performs the `*=` operation.
768780
#[stable(feature = "op_assign_traits", since = "1.8.0")]
@@ -808,6 +820,8 @@ mul_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
808820
#[stable(feature = "op_assign_traits", since = "1.8.0")]
809821
#[rustc_on_unimplemented(message="cannot divide-assign `{Self}` by `{Rhs}`",
810822
label="no implementation for `{Self} /= {Rhs}`")]
823+
#[doc(alias = "/")]
824+
#[doc(alias = "/=")]
811825
pub trait DivAssign<Rhs=Self> {
812826
/// Performs the `/=` operation.
813827
#[stable(feature = "op_assign_traits", since = "1.8.0")]
@@ -856,6 +870,8 @@ div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
856870
#[stable(feature = "op_assign_traits", since = "1.8.0")]
857871
#[rustc_on_unimplemented(message="cannot mod-assign `{Self}` by `{Rhs}``",
858872
label="no implementation for `{Self} %= {Rhs}`")]
873+
#[doc(alias = "%")]
874+
#[doc(alias = "%=")]
859875
pub trait RemAssign<Rhs=Self> {
860876
/// Performs the `%=` operation.
861877
#[stable(feature = "op_assign_traits", since = "1.8.0")]

src/libcore/ops/index.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
#[lang = "index"]
6363
#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
6464
#[stable(feature = "rust1", since = "1.0.0")]
65+
#[doc(alias = "]")]
66+
#[doc(alias = "[")]
67+
#[doc(alias = "[]")]
6568
pub trait Index<Idx: ?Sized> {
6669
/// The returned type after indexing.
6770
#[stable(feature = "rust1", since = "1.0.0")]
@@ -146,6 +149,9 @@ pub trait Index<Idx: ?Sized> {
146149
#[lang = "index_mut"]
147150
#[rustc_on_unimplemented = "the type `{Self}` cannot be mutably indexed by `{Idx}`"]
148151
#[stable(feature = "rust1", since = "1.0.0")]
152+
#[doc(alias = "[")]
153+
#[doc(alias = "]")]
154+
#[doc(alias = "[]")]
149155
pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
150156
/// Performs the mutable indexing (`container[index]`) operation.
151157
#[stable(feature = "rust1", since = "1.0.0")]

src/libcore/ops/try.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
that implement `{Try}`",
2929
label="the `?` operator cannot be applied to type `{Self}`")
3030
)]
31+
#[doc(alias = "?")]
3132
pub trait Try {
3233
/// The type of this value when viewed as successful.
3334
#[unstable(feature = "try_trait", issue = "42327")]

src/libstd/primitive_docs.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ mod prim_pointer { }
502502
mod prim_array { }
503503

504504
#[doc(primitive = "slice")]
505+
#[doc(alias = "[")]
506+
#[doc(alias = "]")]
507+
#[doc(alias = "[]")]
505508
//
506509
/// A dynamically-sized view into a contiguous sequence, `[T]`.
507510
///
@@ -600,6 +603,9 @@ mod prim_slice { }
600603
mod prim_str { }
601604

602605
#[doc(primitive = "tuple")]
606+
#[doc(alias = "(")]
607+
#[doc(alias = ")")]
608+
#[doc(alias = "()")]
603609
//
604610
/// A finite heterogeneous sequence, `(T, U, ..)`.
605611
///
@@ -822,6 +828,7 @@ mod prim_isize { }
822828
mod prim_usize { }
823829

824830
#[doc(primitive = "reference")]
831+
#[doc(alias = "&")]
825832
//
826833
/// References, both shared and mutable.
827834
///

0 commit comments

Comments
 (0)