about summary refs log tree commit diff
path: root/tests/ui/compare-method
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-07-05 20:58:33 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-07-05 20:58:33 +0000
commit75692056e1ab8ca8a5e0c8e2def4cabcf2f3b445 (patch)
tree0cdfbcc1ddcabad13de4047d2be8b8a6db1a4da7 /tests/ui/compare-method
parentc4225812973cee4bba952cbf7a421f69871fed0d (diff)
downloadrust-75692056e1ab8ca8a5e0c8e2def4cabcf2f3b445.tar.gz
rust-75692056e1ab8ca8a5e0c8e2def4cabcf2f3b445.zip
Use verbose suggestion for changing arg type
Diffstat (limited to 'tests/ui/compare-method')
-rw-r--r--tests/ui/compare-method/bad-self-type.stderr18
-rw-r--r--tests/ui/compare-method/issue-90444.stderr18
-rw-r--r--tests/ui/compare-method/reordered-type-param.stderr10
3 files changed, 26 insertions, 20 deletions
diff --git a/tests/ui/compare-method/bad-self-type.stderr b/tests/ui/compare-method/bad-self-type.stderr
index a87b713c2b4..29ebbc5dffb 100644
--- a/tests/ui/compare-method/bad-self-type.stderr
+++ b/tests/ui/compare-method/bad-self-type.stderr
@@ -2,22 +2,20 @@ error[E0053]: method `poll` has an incompatible type for trait
   --> $DIR/bad-self-type.rs:10:13
    |
 LL |     fn poll(self, _: &mut Context<'_>) -> Poll<()> {
-   |             ^^^^
-   |             |
-   |             expected `Pin<&mut MyFuture>`, found `MyFuture`
-   |             help: change the self-receiver type to match the trait: `self: Pin<&mut MyFuture>`
+   |             ^^^^ expected `Pin<&mut MyFuture>`, found `MyFuture`
    |
    = note: expected signature `fn(Pin<&mut MyFuture>, &mut Context<'_>) -> Poll<_>`
               found signature `fn(MyFuture, &mut Context<'_>) -> Poll<_>`
+help: change the self-receiver type to match the trait
+   |
+LL |     fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> {
+   |             ~~~~~~~~~~~~~~~~~~~~~~~~
 
 error[E0053]: method `foo` has an incompatible type for trait
   --> $DIR/bad-self-type.rs:22:18
    |
 LL |     fn foo(self: Box<Self>) {}
-   |            ------^^^^^^^^^
-   |            |     |
-   |            |     expected `MyFuture`, found `Box<MyFuture>`
-   |            help: change the self-receiver type to match the trait: `self`
+   |                  ^^^^^^^^^ expected `MyFuture`, found `Box<MyFuture>`
    |
 note: type in trait
   --> $DIR/bad-self-type.rs:17:12
@@ -26,6 +24,10 @@ LL |     fn foo(self);
    |            ^^^^
    = note: expected signature `fn(MyFuture)`
               found signature `fn(Box<MyFuture>)`
+help: change the self-receiver type to match the trait
+   |
+LL |     fn foo(self) {}
+   |            ~~~~
 
 error[E0053]: method `bar` has an incompatible type for trait
   --> $DIR/bad-self-type.rs:24:17
diff --git a/tests/ui/compare-method/issue-90444.stderr b/tests/ui/compare-method/issue-90444.stderr
index 52e23d03b14..f05c9939c00 100644
--- a/tests/ui/compare-method/issue-90444.stderr
+++ b/tests/ui/compare-method/issue-90444.stderr
@@ -2,25 +2,27 @@ error[E0053]: method `from` has an incompatible type for trait
   --> $DIR/issue-90444.rs:3:16
    |
 LL |     fn from(_: fn((), (), &mut ())) -> Self {
-   |                ^^^^^^^^^^^^^^^^^^^
-   |                |
-   |                types differ in mutability
-   |                help: change the parameter type to match the trait: `for<'a> fn((), (), &'a ())`
+   |                ^^^^^^^^^^^^^^^^^^^ types differ in mutability
    |
    = note: expected signature `fn(for<'a> fn((), (), &'a ())) -> A`
               found signature `fn(for<'a> fn((), (), &'a mut ())) -> A`
+help: change the parameter type to match the trait
+   |
+LL |     fn from(_: for<'a> fn((), (), &'a ())) -> Self {
+   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 error[E0053]: method `from` has an incompatible type for trait
   --> $DIR/issue-90444.rs:11:16
    |
 LL |     fn from(_: fn((), (), u64)) -> Self {
-   |                ^^^^^^^^^^^^^^^
-   |                |
-   |                expected `u32`, found `u64`
-   |                help: change the parameter type to match the trait: `fn((), (), u32)`
+   |                ^^^^^^^^^^^^^^^ expected `u32`, found `u64`
    |
    = note: expected signature `fn(fn((), (), u32)) -> B`
               found signature `fn(fn((), (), u64)) -> B`
+help: change the parameter type to match the trait
+   |
+LL |     fn from(_: fn((), (), u32)) -> Self {
+   |                ~~~~~~~~~~~~~~~
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/compare-method/reordered-type-param.stderr b/tests/ui/compare-method/reordered-type-param.stderr
index 8a439acee13..1e8266e213d 100644
--- a/tests/ui/compare-method/reordered-type-param.stderr
+++ b/tests/ui/compare-method/reordered-type-param.stderr
@@ -2,10 +2,8 @@ error[E0053]: method `b` has an incompatible type for trait
   --> $DIR/reordered-type-param.rs:16:30
    |
 LL |   fn b<F:Clone,G>(&self, _x: G) -> G { panic!() }
-   |        -       -             ^
-   |        |       |             |
-   |        |       |             expected type parameter `F`, found type parameter `G`
-   |        |       |             help: change the parameter type to match the trait: `F`
+   |        -       -             ^ expected type parameter `F`, found type parameter `G`
+   |        |       |
    |        |       found type parameter
    |        expected type parameter
    |
@@ -18,6 +16,10 @@ LL |   fn b<C:Clone,D>(&self, x: C) -> C;
               found signature `fn(&E, G) -> G`
    = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
    = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
+help: change the parameter type to match the trait
+   |
+LL |   fn b<F:Clone,G>(&self, _x: F) -> G { panic!() }
+   |                              ~
 
 error: aborting due to 1 previous error