diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-02-01 05:54:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-01 05:54:37 +0100 |
| commit | 0d2ab6774243451c8743bad2c9dbdf2e61d10f89 (patch) | |
| tree | 9066e8c054962a0f98c866e173ab0550a5b7b335 /library/core/src/ops | |
| parent | ad8e1dc2863f63c35ef3ceef3064d0851a1d2582 (diff) | |
| parent | af9671fd28601c95c4770aa47c733f81ad6ab607 (diff) | |
| download | rust-0d2ab6774243451c8743bad2c9dbdf2e61d10f89.tar.gz rust-0d2ab6774243451c8743bad2c9dbdf2e61d10f89.zip | |
Rollup merge of #107389 - zvavybir:master, r=estebank
Fixing confusion between mod and remainder Like many programming languages, rust too confuses remainder and modulus. The `%` operator and the associated `Rem` trait is (as the trait name suggests) the remainder, but since most people are linguistically more familiar with the modulus the documentation sometimes claims otherwise. This PR tries to fix this problem in rustc.
Diffstat (limited to 'library/core/src/ops')
| -rw-r--r-- | library/core/src/ops/arith.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/ops/arith.rs b/library/core/src/ops/arith.rs index 75c52d3ecfc..cc13db5c956 100644 --- a/library/core/src/ops/arith.rs +++ b/library/core/src/ops/arith.rs @@ -545,7 +545,7 @@ div_impl_float! { f32 f64 } #[lang = "rem"] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_on_unimplemented( - message = "cannot mod `{Self}` by `{Rhs}`", + message = "cannot calculate the remainder of `{Self}` divided by `{Rhs}`", label = "no implementation for `{Self} % {Rhs}`" )] #[doc(alias = "%")] @@ -981,7 +981,7 @@ div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } #[lang = "rem_assign"] #[stable(feature = "op_assign_traits", since = "1.8.0")] #[rustc_on_unimplemented( - message = "cannot mod-assign `{Self}` by `{Rhs}``", + message = "cannot calculate and assign the remainder of `{Self}` divided by `{Rhs}`", label = "no implementation for `{Self} %= {Rhs}`" )] #[doc(alias = "%")] |
