about summary refs log tree commit diff
path: root/library/core/src/ops
diff options
context:
space:
mode:
authormejrs <59372212+mejrs@users.noreply.github.com>2025-05-17 12:50:37 +0200
committermejrs <59372212+mejrs@users.noreply.github.com>2025-05-17 12:50:37 +0200
commitc9b6ccc11ce82c753702716f57f786acf322e64f (patch)
tree4fb04c0d00754ab0b9c8974ecc7783d08f76abde /library/core/src/ops
parentc4e05e53d19b550a358ee8b2e29ecd5a11075800 (diff)
downloadrust-c9b6ccc11ce82c753702716f57f786acf322e64f.tar.gz
rust-c9b6ccc11ce82c753702716f57f786acf322e64f.zip
Switch library rustc_unimplemented to use `Self` and `This`
Diffstat (limited to 'library/core/src/ops')
-rw-r--r--library/core/src/ops/arith.rs4
-rw-r--r--library/core/src/ops/function.rs6
-rw-r--r--library/core/src/ops/index.rs6
-rw-r--r--library/core/src/ops/try_trait.rs18
4 files changed, 17 insertions, 17 deletions
diff --git a/library/core/src/ops/arith.rs b/library/core/src/ops/arith.rs
index 54d79beca95..098ce4531f0 100644
--- a/library/core/src/ops/arith.rs
+++ b/library/core/src/ops/arith.rs
@@ -67,8 +67,8 @@
 #[stable(feature = "rust1", since = "1.0.0")]
 #[rustc_const_unstable(feature = "const_ops", issue = "90080")]
 #[rustc_on_unimplemented(
-    on(all(_Self = "{integer}", Rhs = "{float}"), message = "cannot add a float to an integer",),
-    on(all(_Self = "{float}", Rhs = "{integer}"), message = "cannot add an integer to a float",),
+    on(all(Self = "{integer}", Rhs = "{float}"), message = "cannot add a float to an integer",),
+    on(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}`",
     append_const_msg
diff --git a/library/core/src/ops/function.rs b/library/core/src/ops/function.rs
index e9014458b48..df48c104410 100644
--- a/library/core/src/ops/function.rs
+++ b/library/core/src/ops/function.rs
@@ -62,7 +62,7 @@ use crate::marker::Tuple;
         note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
     ),
     on(
-        _Self = "unsafe fn",
+        Self = "unsafe fn",
         note = "unsafe function cannot be called generically without an unsafe block",
         // SAFETY: tidy is not smart enough to tell that the below unsafe block is a string
         label = "call the function in a closure: `|| unsafe {{ /* code */ }}`"
@@ -149,7 +149,7 @@ pub trait Fn<Args: Tuple>: FnMut<Args> {
         note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
     ),
     on(
-        _Self = "unsafe fn",
+        Self = "unsafe fn",
         note = "unsafe function cannot be called generically without an unsafe block",
         // SAFETY: tidy is not smart enough to tell that the below unsafe block is a string
         label = "call the function in a closure: `|| unsafe {{ /* code */ }}`"
@@ -228,7 +228,7 @@ pub trait FnMut<Args: Tuple>: FnOnce<Args> {
         note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
     ),
     on(
-        _Self = "unsafe fn",
+        Self = "unsafe fn",
         note = "unsafe function cannot be called generically without an unsafe block",
         // SAFETY: tidy is not smart enough to tell that the below unsafe block is a string
         label = "call the function in a closure: `|| unsafe {{ /* code */ }}`"
diff --git a/library/core/src/ops/index.rs b/library/core/src/ops/index.rs
index 46e19bed43a..8092fa9eb2f 100644
--- a/library/core/src/ops/index.rs
+++ b/library/core/src/ops/index.rs
@@ -144,17 +144,17 @@ pub trait Index<Idx: ?Sized> {
 #[lang = "index_mut"]
 #[rustc_on_unimplemented(
     on(
-        _Self = "&str",
+        Self = "&str",
         note = "you can use `.chars().nth()` or `.bytes().nth()`
 see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>"
     ),
     on(
-        _Self = "str",
+        Self = "str",
         note = "you can use `.chars().nth()` or `.bytes().nth()`
 see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>"
     ),
     on(
-        _Self = "alloc::string::String",
+        Self = "alloc::string::String",
         note = "you can use `.chars().nth()` or `.bytes().nth()`
 see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>"
     ),
diff --git a/library/core/src/ops/try_trait.rs b/library/core/src/ops/try_trait.rs
index 3ba2957526f..bac8ffb074b 100644
--- a/library/core/src/ops/try_trait.rs
+++ b/library/core/src/ops/try_trait.rs
@@ -117,12 +117,12 @@ use crate::ops::ControlFlow;
     on(
         all(from_desugaring = "TryBlock"),
         message = "a `try` block must return `Result` or `Option` \
-                    (or another type that implements `{Try}`)",
+                    (or another type that implements `{This}`)",
         label = "could not wrap the final value of the block as `{Self}` doesn't implement `Try`",
     ),
     on(
         all(from_desugaring = "QuestionMark"),
-        message = "the `?` operator can only be applied to values that implement `{Try}`",
+        message = "the `?` operator can only be applied to values that implement `{This}`",
         label = "the `?` operator cannot be applied to type `{Self}`"
     )
 )]
@@ -226,7 +226,7 @@ pub trait Try: FromResidual {
     on(
         all(
             from_desugaring = "QuestionMark",
-            _Self = "core::result::Result<T, E>",
+            Self = "core::result::Result<T, E>",
             R = "core::option::Option<core::convert::Infallible>",
         ),
         message = "the `?` operator can only be used on `Result`s, not `Option`s, \
@@ -237,7 +237,7 @@ pub trait Try: FromResidual {
     on(
         all(
             from_desugaring = "QuestionMark",
-            _Self = "core::result::Result<T, E>",
+            Self = "core::result::Result<T, E>",
         ),
         // There's a special error message in the trait selection code for
         // `From` in `?`, so this is not shown for result-in-result errors,
@@ -250,7 +250,7 @@ pub trait Try: FromResidual {
     on(
         all(
             from_desugaring = "QuestionMark",
-            _Self = "core::option::Option<T>",
+            Self = "core::option::Option<T>",
             R = "core::result::Result<T, E>",
         ),
         message = "the `?` operator can only be used on `Option`s, not `Result`s, \
@@ -261,7 +261,7 @@ pub trait Try: FromResidual {
     on(
         all(
             from_desugaring = "QuestionMark",
-            _Self = "core::option::Option<T>",
+            Self = "core::option::Option<T>",
         ),
         // `Option`-in-`Option` always works, as there's only one possible
         // residual, so this can also be phrased strongly.
@@ -273,7 +273,7 @@ pub trait Try: FromResidual {
     on(
         all(
             from_desugaring = "QuestionMark",
-            _Self = "core::ops::control_flow::ControlFlow<B, C>",
+            Self = "core::ops::control_flow::ControlFlow<B, C>",
             R = "core::ops::control_flow::ControlFlow<B, C>",
         ),
         message = "the `?` operator in {ItemContext} that returns `ControlFlow<B, _>` \
@@ -285,7 +285,7 @@ pub trait Try: FromResidual {
     on(
         all(
             from_desugaring = "QuestionMark",
-            _Self = "core::ops::control_flow::ControlFlow<B, C>",
+            Self = "core::ops::control_flow::ControlFlow<B, C>",
             // `R` is not a `ControlFlow`, as that case was matched previously
         ),
         message = "the `?` operator can only be used on `ControlFlow`s \
@@ -297,7 +297,7 @@ pub trait Try: FromResidual {
         all(from_desugaring = "QuestionMark"),
         message = "the `?` operator can only be used in {ItemContext} \
                     that returns `Result` or `Option` \
-                    (or another type that implements `{FromResidual}`)",
+                    (or another type that implements `{This}`)",
         label = "cannot use the `?` operator in {ItemContext} that returns `{Self}`",
         parent_label = "this function should return `Result` or `Option` to accept `?`"
     ),