Skip to content

Commit 225b6ba

Browse files
authored
Rollup merge of rust-lang#59190 - greg-kargin:master, r=sanxiyn
consistent naming for Rhs type parameter in libcore/ops Rename RHS type parameter occurrences RHS->Rhs to make it consistent throughout files and follow naming conventions.
2 parents e744fb7 + 7f395d2 commit 225b6ba

File tree

4 files changed

+56
-56
lines changed

4 files changed

+56
-56
lines changed

src/libcore/ops/arith.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// The addition operator `+`.
22
///
3-
/// Note that `RHS` is `Self` by default, but this is not mandatory. For
3+
/// Note that `Rhs` is `Self` by default, but this is not mandatory. For
44
/// example, [`std::time::SystemTime`] implements `Add<Duration>`, which permits
55
/// operations of the form `SystemTime = SystemTime + Duration`.
66
///
@@ -67,26 +67,26 @@
6767
#[stable(feature = "rust1", since = "1.0.0")]
6868
#[rustc_on_unimplemented(
6969
on(
70-
all(_Self="{integer}", RHS="{float}"),
70+
all(_Self="{integer}", Rhs="{float}"),
7171
message="cannot add a float to an integer",
7272
),
7373
on(
74-
all(_Self="{float}", RHS="{integer}"),
74+
all(_Self="{float}", Rhs="{integer}"),
7575
message="cannot add an integer to a float",
7676
),
77-
message="cannot add `{RHS}` to `{Self}`",
78-
label="no implementation for `{Self} + {RHS}`",
77+
message="cannot add `{Rhs}` to `{Self}`",
78+
label="no implementation for `{Self} + {Rhs}`",
7979
)]
8080
#[doc(alias = "+")]
81-
pub trait Add<RHS=Self> {
81+
pub trait Add<Rhs=Self> {
8282
/// The resulting type after applying the `+` operator.
8383
#[stable(feature = "rust1", since = "1.0.0")]
8484
type Output;
8585

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

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

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

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

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

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

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

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

327327
/// The division operator `/`.
328328
///
329-
/// Note that `RHS` is `Self` by default, but this is not mandatory.
329+
/// Note that `Rhs` is `Self` by default, but this is not mandatory.
330330
///
331331
/// # Examples
332332
///
@@ -417,18 +417,18 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
417417
/// ```
418418
#[lang = "div"]
419419
#[stable(feature = "rust1", since = "1.0.0")]
420-
#[rustc_on_unimplemented(message="cannot divide `{Self}` by `{RHS}`",
421-
label="no implementation for `{Self} / {RHS}`")]
420+
#[rustc_on_unimplemented(message="cannot divide `{Self}` by `{Rhs}`",
421+
label="no implementation for `{Self} / {Rhs}`")]
422422
#[doc(alias = "/")]
423-
pub trait Div<RHS=Self> {
423+
pub trait Div<Rhs=Self> {
424424
/// The resulting type after applying the `/` operator.
425425
#[stable(feature = "rust1", since = "1.0.0")]
426426
type Output;
427427

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

434434
macro_rules! div_impl_integer {
@@ -467,7 +467,7 @@ div_impl_float! { f32 f64 }
467467

468468
/// The remainder operator `%`.
469469
///
470-
/// Note that `RHS` is `Self` by default, but this is not mandatory.
470+
/// Note that `Rhs` is `Self` by default, but this is not mandatory.
471471
///
472472
/// # Examples
473473
///
@@ -502,18 +502,18 @@ div_impl_float! { f32 f64 }
502502
/// ```
503503
#[lang = "rem"]
504504
#[stable(feature = "rust1", since = "1.0.0")]
505-
#[rustc_on_unimplemented(message="cannot mod `{Self}` by `{RHS}`",
506-
label="no implementation for `{Self} % {RHS}`")]
505+
#[rustc_on_unimplemented(message="cannot mod `{Self}` by `{Rhs}`",
506+
label="no implementation for `{Self} % {Rhs}`")]
507507
#[doc(alias = "%")]
508-
pub trait Rem<RHS=Self> {
508+
pub trait Rem<Rhs=Self> {
509509
/// The resulting type after applying the `%` operator.
510510
#[stable(feature = "rust1", since = "1.0.0")]
511511
type Output = Self;
512512

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

519519
macro_rules! rem_impl_integer {

src/libcore/ops/bit.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ not_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
5959

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

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

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

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

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

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

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

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

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

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

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

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

496496
macro_rules! shr_impl {

src/test/ui/issues/issue-21950.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0393]: the type parameter `RHS` must be explicitly specified
1+
error[E0393]: the type parameter `Rhs` must be explicitly specified
22
--> $DIR/issue-21950.rs:7:14
33
|
44
LL | &Add;
5-
| ^^^ missing reference to `RHS`
5+
| ^^^ missing reference to `Rhs`
66
|
77
= note: because of the default `Self` reference, type parameters must be specified on object types
88

src/test/ui/issues/issue-22560.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
error[E0393]: the type parameter `RHS` must be explicitly specified
1+
error[E0393]: the type parameter `Rhs` must be explicitly specified
22
--> $DIR/issue-22560.rs:5:13
33
|
44
LL | type Test = Add +
5-
| ^^^ missing reference to `RHS`
5+
| ^^^ missing reference to `Rhs`
66
|
77
= note: because of the default `Self` reference, type parameters must be specified on object types
88

9-
error[E0393]: the type parameter `RHS` must be explicitly specified
9+
error[E0393]: the type parameter `Rhs` must be explicitly specified
1010
--> $DIR/issue-22560.rs:8:13
1111
|
1212
LL | Sub;
13-
| ^^^ missing reference to `RHS`
13+
| ^^^ missing reference to `Rhs`
1414
|
1515
= note: because of the default `Self` reference, type parameters must be specified on object types
1616

0 commit comments

Comments
 (0)