]> git.lizzy.rs Git - rust.git/commitdiff
fixed all the compile-fail error messages
authorMichael Hewson <michael@michaelhewson.ca>
Thu, 9 Nov 2017 14:16:55 +0000 (09:16 -0500)
committerMichael Hewson <michael@michaelhewson.ca>
Thu, 9 Nov 2017 14:16:55 +0000 (09:16 -0500)
now that we've fixed the bug where constraint origins were getting overwritten, the good error messages are back (with some tweaks)

src/test/compile-fail/explicit-self-lifetime-mismatch.rs
src/test/compile-fail/issue-17740.rs
src/test/compile-fail/ufcs-explicit-self-bad.rs

index 0c3ee1739a312f4720fd670e79831b118d61a697..eac134ff3cc7d6b287cf83a34ca4c67862897d20 100644 (file)
@@ -1,5 +1,3 @@
-//~  ERROR mismatched types
-//~| ERROR mismatched types
 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
@@ -16,7 +14,17 @@ struct Foo<'a,'b> {
 }
 
 impl<'a,'b> Foo<'a,'b> {
-    fn bar(self: Foo<'b,'a>) {}
+    fn bar(self:
+           Foo<'b,'a>
+    //~^ ERROR mismatched method receiver
+    //~| expected type `Foo<'a, 'b>`
+    //~| found type `Foo<'b, 'a>`
+    //~| lifetime mismatch
+    //~| ERROR mismatched method receiver
+    //~| expected type `Foo<'a, 'b>`
+    //~| found type `Foo<'b, 'a>`
+    //~| lifetime mismatch
+           ) {}
 }
 
 fn main() {}
index 99a7d39ce8456ee1ca2fb399ab2f5f0110ae2039..1d5ef4360dc1ebc9134451f2cdd0b70eab6c7f66 100644 (file)
@@ -1,5 +1,3 @@
-//~  ERROR mismatched types
-//~| ERROR mismatched types
 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
@@ -16,6 +14,14 @@ struct Foo<'a> {
 
 impl <'a> Foo<'a>{
     fn bar(self: &mut Foo) {
+    //~^ mismatched method receiver
+    //~| expected type `Foo<'a>`
+    //~| found type `Foo<'_>`
+    //~| lifetime mismatch
+    //~| mismatched method receiver
+    //~| expected type `Foo<'a>`
+    //~| found type `Foo<'_>`
+    //~| lifetime mismatch
     }
 }
 
index 553fd79f5e50b535a07e2b55e268bb1e785ac409..5160ceaf48e49bac9627eb58eff6fdc2d8821600 100644 (file)
@@ -1,7 +1,3 @@
-//~  ERROR mismatched types
-//~| ERROR mismatched types
-//~| ERROR mismatched types
-//~| ERROR mismatched types
 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
@@ -51,8 +47,17 @@ trait SomeTrait {
 
 impl<'a, T> SomeTrait for &'a Bar<T> {
     fn dummy1(self: &&'a Bar<T>) { }
-    fn dummy2(self: &Bar<T>) {}
+    fn dummy2(self: &Bar<T>) {} //~ ERROR mismatched method receiver
+    //~^ ERROR mismatched method receiver
     fn dummy3(self: &&Bar<T>) {}
+    //~^ ERROR mismatched method receiver
+    //~| expected type `&'a Bar<T>`
+    //~| found type `&Bar<T>`
+    //~| lifetime mismatch
+    //~| ERROR mismatched method receiver
+    //~| expected type `&'a Bar<T>`
+    //~| found type `&Bar<T>`
+    //~| lifetime mismatch
 }
 
 fn main() {