summaryrefslogtreecommitdiffstats
path: root/tests/ui/ufcs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/ufcs/ufcs-explicit-self-bad.rs1
-rw-r--r--tests/ui/ufcs/ufcs-explicit-self-bad.stderr31
2 files changed, 25 insertions, 7 deletions
diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.rs b/tests/ui/ufcs/ufcs-explicit-self-bad.rs
index cb1fac0ba..9b0f99a18 100644
--- a/tests/ui/ufcs/ufcs-explicit-self-bad.rs
+++ b/tests/ui/ufcs/ufcs-explicit-self-bad.rs
@@ -36,6 +36,7 @@ impl<'a, T> SomeTrait for &'a Bar<T> {
fn dummy1(self: &&'a Bar<T>) { }
fn dummy2(self: &Bar<T>) {} //~ ERROR mismatched `self` parameter type
//~^ ERROR mismatched `self` parameter type
+ //~| ERROR has an incompatible type for trait
fn dummy3(self: &&Bar<T>) {}
//~^ ERROR mismatched `self` parameter type
//~| expected reference `&'a Bar<T>`
diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr
index f325d1d81..0efaa41d4 100644
--- a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr
+++ b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr
@@ -64,7 +64,7 @@ LL | fn dummy2(self: &Bar<T>) {}
| ^^^^^^^
error[E0308]: mismatched `self` parameter type
- --> $DIR/ufcs-explicit-self-bad.rs:39:21
+ --> $DIR/ufcs-explicit-self-bad.rs:40:21
|
LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^^ lifetime mismatch
@@ -72,7 +72,7 @@ LL | fn dummy3(self: &&Bar<T>) {}
= note: expected reference `&'a Bar<T>`
found reference `&Bar<T>`
note: the anonymous lifetime defined here...
- --> $DIR/ufcs-explicit-self-bad.rs:39:22
+ --> $DIR/ufcs-explicit-self-bad.rs:40:22
|
LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^
@@ -83,7 +83,7 @@ LL | impl<'a, T> SomeTrait for &'a Bar<T> {
| ^^
error[E0308]: mismatched `self` parameter type
- --> $DIR/ufcs-explicit-self-bad.rs:39:21
+ --> $DIR/ufcs-explicit-self-bad.rs:40:21
|
LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^^ lifetime mismatch
@@ -96,12 +96,29 @@ note: the lifetime `'a` as defined here...
LL | impl<'a, T> SomeTrait for &'a Bar<T> {
| ^^
note: ...does not necessarily outlive the anonymous lifetime defined here
- --> $DIR/ufcs-explicit-self-bad.rs:39:22
+ --> $DIR/ufcs-explicit-self-bad.rs:40:22
|
LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^
-error: aborting due to 7 previous errors
+error[E0053]: method `dummy2` has an incompatible type for trait
+ --> $DIR/ufcs-explicit-self-bad.rs:37:21
+ |
+LL | fn dummy2(self: &Bar<T>) {}
+ | ------^^^^^^^
+ | | |
+ | | expected `&'a Bar<T>`, found `Bar<T>`
+ | help: change the self-receiver type to match the trait: `&self`
+ |
+note: type in trait
+ --> $DIR/ufcs-explicit-self-bad.rs:31:15
+ |
+LL | fn dummy2(&self);
+ | ^^^^^
+ = note: expected signature `fn(&&'a Bar<T>)`
+ found signature `fn(&Bar<T>)`
+
+error: aborting due to 8 previous errors
-Some errors have detailed explanations: E0307, E0308.
-For more information about an error, try `rustc --explain E0307`.
+Some errors have detailed explanations: E0053, E0307, E0308.
+For more information about an error, try `rustc --explain E0053`.