Skip to content

Commit

Permalink
consistent naming for Rhs type parameter in libcore/ops
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-kargin committed Mar 14, 2019
1 parent bc44841 commit fec0ff2
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 50 deletions.
54 changes: 27 additions & 27 deletions src/libcore/ops/arith.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// The addition operator `+`.
///
/// Note that `RHS` is `Self` by default, but this is not mandatory. For
/// Note that `Rhs` is `Self` by default, but this is not mandatory. For
/// example, [`std::time::SystemTime`] implements `Add<Duration>`, which permits
/// operations of the form `SystemTime = SystemTime + Duration`.
///
Expand Down Expand Up @@ -67,26 +67,26 @@
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(
on(
all(_Self="{integer}", RHS="{float}"),
all(_Self="{integer}", Rhs="{float}"),
message="cannot add a float to an integer",
),
on(
all(_Self="{float}", RHS="{integer}"),
all(_Self="{float}", Rhs="{integer}"),
message="cannot add an integer to a float",
),
message="cannot add `{RHS}` to `{Self}`",
label="no implementation for `{Self} + {RHS}`",
message="cannot add `{Rhs}` to `{Self}`",
label="no implementation for `{Self} + {Rhs}`",
)]
#[doc(alias = "+")]
pub trait Add<RHS=Self> {
pub trait Add<Rhs=Self> {
/// The resulting type after applying the `+` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;

/// Performs the `+` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn add(self, rhs: RHS) -> Self::Output;
fn add(self, rhs: Rhs) -> Self::Output;
}

macro_rules! add_impl {
Expand All @@ -108,7 +108,7 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }

/// The subtraction operator `-`.
///
/// Note that `RHS` is `Self` by default, but this is not mandatory. For
/// Note that `Rhs` is `Self` by default, but this is not mandatory. For
/// example, [`std::time::SystemTime`] implements `Sub<Duration>`, which permits
/// operations of the form `SystemTime = SystemTime - Duration`.
///
Expand Down Expand Up @@ -173,18 +173,18 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// ```
#[lang = "sub"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(message="cannot subtract `{RHS}` from `{Self}`",
label="no implementation for `{Self} - {RHS}`")]
#[rustc_on_unimplemented(message="cannot subtract `{Rhs}` from `{Self}`",
label="no implementation for `{Self} - {Rhs}`")]
#[doc(alias = "-")]
pub trait Sub<RHS=Self> {
pub trait Sub<Rhs=Self> {
/// The resulting type after applying the `-` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;

/// Performs the `-` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn sub(self, rhs: RHS) -> Self::Output;
fn sub(self, rhs: Rhs) -> Self::Output;
}

macro_rules! sub_impl {
Expand All @@ -206,7 +206,7 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }

/// The multiplication operator `*`.
///
/// Note that `RHS` is `Self` by default, but this is not mandatory.
/// Note that `Rhs` is `Self` by default, but this is not mandatory.
///
/// # Examples
///
Expand Down Expand Up @@ -293,18 +293,18 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// ```
#[lang = "mul"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(message="cannot multiply `{RHS}` to `{Self}`",
label="no implementation for `{Self} * {RHS}`")]
#[rustc_on_unimplemented(message="cannot multiply `{Rhs}` to `{Self}`",
label="no implementation for `{Self} * {Rhs}`")]
#[doc(alias = "*")]
pub trait Mul<RHS=Self> {
pub trait Mul<Rhs=Self> {
/// The resulting type after applying the `*` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;

/// Performs the `*` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn mul(self, rhs: RHS) -> Self::Output;
fn mul(self, rhs: Rhs) -> Self::Output;
}

macro_rules! mul_impl {
Expand All @@ -326,7 +326,7 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }

/// The division operator `/`.
///
/// Note that `RHS` is `Self` by default, but this is not mandatory.
/// Note that `Rhs` is `Self` by default, but this is not mandatory.
///
/// # Examples
///
Expand Down Expand Up @@ -417,18 +417,18 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
/// ```
#[lang = "div"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(message="cannot divide `{Self}` by `{RHS}`",
label="no implementation for `{Self} / {RHS}`")]
#[rustc_on_unimplemented(message="cannot divide `{Self}` by `{Rhs}`",
label="no implementation for `{Self} / {Rhs}`")]
#[doc(alias = "/")]
pub trait Div<RHS=Self> {
pub trait Div<Rhs=Self> {
/// The resulting type after applying the `/` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;

/// Performs the `/` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn div(self, rhs: RHS) -> Self::Output;
fn div(self, rhs: Rhs) -> Self::Output;
}

macro_rules! div_impl_integer {
Expand Down Expand Up @@ -467,7 +467,7 @@ div_impl_float! { f32 f64 }

/// The remainder operator `%`.
///
/// Note that `RHS` is `Self` by default, but this is not mandatory.
/// Note that `Rhs` is `Self` by default, but this is not mandatory.
///
/// # Examples
///
Expand Down Expand Up @@ -502,18 +502,18 @@ div_impl_float! { f32 f64 }
/// ```
#[lang = "rem"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(message="cannot mod `{Self}` by `{RHS}`",
label="no implementation for `{Self} % {RHS}`")]
#[rustc_on_unimplemented(message="cannot mod `{Self}` by `{Rhs}`",
label="no implementation for `{Self} % {Rhs}`")]
#[doc(alias = "%")]
pub trait Rem<RHS=Self> {
pub trait Rem<Rhs=Self> {
/// The resulting type after applying the `%` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output = Self;

/// Performs the `%` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn rem(self, rhs: RHS) -> Self::Output;
fn rem(self, rhs: Rhs) -> Self::Output;
}

macro_rules! rem_impl_integer {
Expand Down
46 changes: 23 additions & 23 deletions src/libcore/ops/bit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ not_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }

/// The bitwise AND operator `&`.
///
/// Note that `RHS` is `Self` by default, but this is not mandatory.
/// Note that `Rhs` is `Self` by default, but this is not mandatory.
///
/// # Examples
///
Expand Down Expand Up @@ -112,17 +112,17 @@ not_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
#[lang = "bitand"]
#[doc(alias = "&")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(message="no implementation for `{Self} & {RHS}`",
label="no implementation for `{Self} & {RHS}`")]
pub trait BitAnd<RHS=Self> {
#[rustc_on_unimplemented(message="no implementation for `{Self} & {Rhs}`",
label="no implementation for `{Self} & {Rhs}`")]
pub trait BitAnd<Rhs=Self> {
/// The resulting type after applying the `&` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;

/// Performs the `&` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn bitand(self, rhs: RHS) -> Self::Output;
fn bitand(self, rhs: Rhs) -> Self::Output;
}

macro_rules! bitand_impl {
Expand All @@ -143,7 +143,7 @@ bitand_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }

/// The bitwise OR operator `|`.
///
/// Note that `RHS` is `Self` by default, but this is not mandatory.
/// Note that `Rhs` is `Self` by default, but this is not mandatory.
///
/// # Examples
///
Expand Down Expand Up @@ -196,17 +196,17 @@ bitand_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
#[lang = "bitor"]
#[doc(alias = "|")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(message="no implementation for `{Self} | {RHS}`",
label="no implementation for `{Self} | {RHS}`")]
pub trait BitOr<RHS=Self> {
#[rustc_on_unimplemented(message="no implementation for `{Self} | {Rhs}`",
label="no implementation for `{Self} | {Rhs}`")]
pub trait BitOr<Rhs=Self> {
/// The resulting type after applying the `|` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;

/// Performs the `|` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn bitor(self, rhs: RHS) -> Self::Output;
fn bitor(self, rhs: Rhs) -> Self::Output;
}

macro_rules! bitor_impl {
Expand All @@ -227,7 +227,7 @@ bitor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }

/// The bitwise XOR operator `^`.
///
/// Note that `RHS` is `Self` by default, but this is not mandatory.
/// Note that `Rhs` is `Self` by default, but this is not mandatory.
///
/// # Examples
///
Expand Down Expand Up @@ -283,17 +283,17 @@ bitor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
#[lang = "bitxor"]
#[doc(alias = "^")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(message="no implementation for `{Self} ^ {RHS}`",
label="no implementation for `{Self} ^ {RHS}`")]
pub trait BitXor<RHS=Self> {
#[rustc_on_unimplemented(message="no implementation for `{Self} ^ {Rhs}`",
label="no implementation for `{Self} ^ {Rhs}`")]
pub trait BitXor<Rhs=Self> {
/// The resulting type after applying the `^` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;

/// Performs the `^` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn bitxor(self, rhs: RHS) -> Self::Output;
fn bitxor(self, rhs: Rhs) -> Self::Output;
}

macro_rules! bitxor_impl {
Expand Down Expand Up @@ -371,17 +371,17 @@ bitxor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
#[lang = "shl"]
#[doc(alias = "<<")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(message="no implementation for `{Self} << {RHS}`",
label="no implementation for `{Self} << {RHS}`")]
pub trait Shl<RHS=Self> {
#[rustc_on_unimplemented(message="no implementation for `{Self} << {Rhs}`",
label="no implementation for `{Self} << {Rhs}`")]
pub trait Shl<Rhs=Self> {
/// The resulting type after applying the `<<` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;

/// Performs the `<<` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn shl(self, rhs: RHS) -> Self::Output;
fn shl(self, rhs: Rhs) -> Self::Output;
}

macro_rules! shl_impl {
Expand Down Expand Up @@ -480,17 +480,17 @@ shl_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 isize i128 }
#[lang = "shr"]
#[doc(alias = ">>")]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(message="no implementation for `{Self} >> {RHS}`",
label="no implementation for `{Self} >> {RHS}`")]
pub trait Shr<RHS=Self> {
#[rustc_on_unimplemented(message="no implementation for `{Self} >> {Rhs}`",
label="no implementation for `{Self} >> {Rhs}`")]
pub trait Shr<Rhs=Self> {
/// The resulting type after applying the `>>` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;

/// Performs the `>>` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn shr(self, rhs: RHS) -> Self::Output;
fn shr(self, rhs: Rhs) -> Self::Output;
}

macro_rules! shr_impl {
Expand Down

0 comments on commit fec0ff2

Please sign in to comment.