about summary refs log tree commit diff
path: root/tests/ui/ufcs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-25 10:49:24 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-25 12:04:54 +0000
commitbeaf46f7e5a103207e8c2f8c9ffe8409f487168d (patch)
tree7d54978992289b72fad89797cc9a1d5317cf4356 /tests/ui/ufcs
parentc716f180e8c48b12bb055e6a7dea2a7f474cf66d (diff)
downloadrust-beaf46f7e5a103207e8c2f8c9ffe8409f487168d.tar.gz
rust-beaf46f7e5a103207e8c2f8c9ffe8409f487168d.zip
Work around the fact that `check_mod_type_wf` may spuriously return `ErrorGuaranteed`, even if that error is only emitted by `check_modwitem_types`
Diffstat (limited to 'tests/ui/ufcs')
-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 cb1fac0bae6..9b0f99a189a 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 f325d1d8182..0efaa41d48a 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`.