about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2014-11-15 16:58:09 -0500
committerNiko Matsakis <niko@alum.mit.edu>2014-11-18 12:32:38 -0500
commitefef81e966a4e9b29dd37f690ab068ceb5447a1a (patch)
tree62043dfdc7efb6fed51d4f8e13aeed1d71b7b3c9 /src/test
parentc8a94c5dfaaf5f1dacc110bb81d292c4382554d9 (diff)
downloadrust-efef81e966a4e9b29dd37f690ab068ceb5447a1a.tar.gz
rust-efef81e966a4e9b29dd37f690ab068ceb5447a1a.zip
Stop checking the correctness of explicit self twice; instead, just
use simple pattern matching to take a guess at what the method's self
category is in astconv, and check it more thoroughly later.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/explicit-self-lifetime-mismatch.rs3
-rw-r--r--src/test/compile-fail/ufcs-explicit-self-bad.rs16
2 files changed, 13 insertions, 6 deletions
diff --git a/src/test/compile-fail/explicit-self-lifetime-mismatch.rs b/src/test/compile-fail/explicit-self-lifetime-mismatch.rs
index d1ae535d830..9b2264b8902 100644
--- a/src/test/compile-fail/explicit-self-lifetime-mismatch.rs
+++ b/src/test/compile-fail/explicit-self-lifetime-mismatch.rs
@@ -14,12 +14,9 @@ struct Foo<'a,'b> {
 }
 
 impl<'a,'b> Foo<'a,'b> {
-    // The number of errors is related to the way invariance works.
     fn bar(self: Foo<'b,'a>) {}
     //~^ ERROR mismatched types: expected `Foo<'a, 'b>`, found `Foo<'b, 'a>`
     //~^^ ERROR mismatched types: expected `Foo<'a, 'b>`, found `Foo<'b, 'a>`
-    //~^^^ ERROR mismatched types: expected `Foo<'b, 'a>`, found `Foo<'a, 'b>`
-    //~^^^^ ERROR mismatched types: expected `Foo<'b, 'a>`, found `Foo<'a, 'b>`
 }
 
 fn main() {}
diff --git a/src/test/compile-fail/ufcs-explicit-self-bad.rs b/src/test/compile-fail/ufcs-explicit-self-bad.rs
index b639af61757..8d3610affdf 100644
--- a/src/test/compile-fail/ufcs-explicit-self-bad.rs
+++ b/src/test/compile-fail/ufcs-explicit-self-bad.rs
@@ -14,7 +14,6 @@ struct Foo {
 
 impl Foo {
     fn foo(self: int, x: int) -> int {  //~ ERROR mismatched self type
-//~^ ERROR not a valid type for `self`
         self.f + x
     }
 }
@@ -25,15 +24,26 @@ struct Bar<T> {
 
 impl<T> Bar<T> {
     fn foo(self: Bar<int>, x: int) -> int { //~ ERROR mismatched self type
-//~^ ERROR not a valid type for `self`
         x
     }
     fn bar(self: &Bar<uint>, x: int) -> int {   //~ ERROR mismatched self type
-//~^ ERROR not a valid type for `self`
         x
     }
 }
 
+trait SomeTrait {
+    fn dummy1(&self);
+    fn dummy2(&self);
+    fn dummy3(&self);
+}
+
+impl<'a, T> SomeTrait for &'a Bar<T> {
+    fn dummy1(self: &&'a Bar<T>) { }
+    fn dummy2(self: &Bar<T>) {} //~ ERROR mismatched self type
+    fn dummy3(self: &&Bar<T>) {} //~ ERROR lifetime mismatch
+    //~^ ERROR lifetime mismatch
+}
+
 fn main() {
     let foo = box Foo {
         f: 1,