about summary refs log tree commit diff
path: root/src/test/ui/compare-method
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/compare-method')
-rw-r--r--src/test/ui/compare-method/bad-self-type.rs3
-rw-r--r--src/test/ui/compare-method/bad-self-type.stderr19
2 files changed, 20 insertions, 2 deletions
diff --git a/src/test/ui/compare-method/bad-self-type.rs b/src/test/ui/compare-method/bad-self-type.rs
index 9eb978664bf..f42a9e49abd 100644
--- a/src/test/ui/compare-method/bad-self-type.rs
+++ b/src/test/ui/compare-method/bad-self-type.rs
@@ -15,9 +15,12 @@ impl Future for MyFuture {
 
 trait T {
     fn foo(self);
+    fn bar(self) -> Option<()>;
 }
 
 impl T for MyFuture {
     fn foo(self: Box<Self>) {}
     //~^ ERROR method `foo` has an incompatible type for trait
+    fn bar(self) {}
+    //~^ ERROR method `bar` has an incompatible type for trait
 }
diff --git a/src/test/ui/compare-method/bad-self-type.stderr b/src/test/ui/compare-method/bad-self-type.stderr
index 4d85ff86df5..74e7c562aa7 100644
--- a/src/test/ui/compare-method/bad-self-type.stderr
+++ b/src/test/ui/compare-method/bad-self-type.stderr
@@ -11,7 +11,7 @@ LL |     fn poll(self, _: &mut Context<'_>) -> Poll<()> {
               found fn pointer `fn(MyFuture, &mut Context<'_>) -> Poll<_>`
 
 error[E0053]: method `foo` has an incompatible type for trait
-  --> $DIR/bad-self-type.rs:21:18
+  --> $DIR/bad-self-type.rs:22:18
    |
 LL |     fn foo(self);
    |            ---- type in trait
@@ -25,6 +25,21 @@ LL |     fn foo(self: Box<Self>) {}
    = note: expected fn pointer `fn(MyFuture)`
               found fn pointer `fn(Box<MyFuture>)`
 
-error: aborting due to 2 previous errors
+error[E0053]: method `bar` has an incompatible type for trait
+  --> $DIR/bad-self-type.rs:24:18
+   |
+LL |     fn bar(self) -> Option<()>;
+   |                     ---------- type in trait
+...
+LL |     fn bar(self) {}
+   |                  ^
+   |                  |
+   |                  expected enum `Option`, found `()`
+   |                  help: change the output type to match the trait: `-> Option<()>`
+   |
+   = note: expected fn pointer `fn(MyFuture) -> Option<()>`
+              found fn pointer `fn(MyFuture)`
+
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0053`.