about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-08-09 19:50:03 +0000
committerbors <bors@rust-lang.org>2017-08-09 19:50:03 +0000
commitf142499539d038ef60f4e22cafe11ecdd8a29a1d (patch)
tree0a0dbb8de48b38587afcc77e43a5d837e629d127 /src/test/compile-fail
parent33d71944cd359db9d90718abe37559d419070eb9 (diff)
parent9bd62a4691346a30f7aa26cf3b6d726695cf7eee (diff)
downloadrust-f142499539d038ef60f4e22cafe11ecdd8a29a1d.tar.gz
rust-f142499539d038ef60f4e22cafe11ecdd8a29a1d.zip
Auto merge of #43484 - estebank:point-to-return, r=arielb1
Point at return type always when type mismatch against it

Before this, the diagnostic errors would only point at the return type
when changing it would be a possible solution to a type error. Add a
label to the return type without a suggestion to change in order to make
the source of the expected type obvious.

Follow up to #42850, fixes #25133, fixes #41897.
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/struct-path-self-type-mismatch.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/test/compile-fail/struct-path-self-type-mismatch.rs b/src/test/compile-fail/struct-path-self-type-mismatch.rs
index f694e7d277c..ad568b41fcb 100644
--- a/src/test/compile-fail/struct-path-self-type-mismatch.rs
+++ b/src/test/compile-fail/struct-path-self-type-mismatch.rs
@@ -20,17 +20,15 @@ impl Bar for Foo<i32> {
 }
 
 impl<T> Foo<T> {
-    fn new<U>(u: U) -> Foo<U> {
+    fn new<U>(u: U) -> Foo<U> { //~ NOTE expected `Foo<U>` because of return type
         Self {
         //~^ ERROR mismatched types
-        //~| expected type parameter, found a different type parameter
-        //~| expected type `Foo<U>`
-        //~| found type `Foo<T>`
+        //~| NOTE expected type parameter, found a different type parameter
+        //~| NOTE expected type `Foo<U>`
             inner: u
             //~^ ERROR mismatched types
-            //~| expected type parameter, found a different type parameter
-            //~| expected type `T`
-            //~| found type `U`
+            //~| NOTE expected type parameter, found a different type parameter
+            //~| NOTE expected type `T`
         }
     }
 }