Skip to content

Commit 31d3783

Browse files
committed
fixed all the compile-fail error messages
now that we've fixed the bug where constraint origins were getting overwritten, the good error messages are back (with some tweaks)
1 parent dcbb27a commit 31d3783

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

src/test/compile-fail/explicit-self-lifetime-mismatch.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//~ ERROR mismatched types
2-
//~| ERROR mismatched types
31
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
42
// file at the top-level directory of this distribution and at
53
// http://rust-lang.org/COPYRIGHT.
@@ -16,7 +14,17 @@ struct Foo<'a,'b> {
1614
}
1715

1816
impl<'a,'b> Foo<'a,'b> {
19-
fn bar(self: Foo<'b,'a>) {}
17+
fn bar(self:
18+
Foo<'b,'a>
19+
//~^ ERROR mismatched method receiver
20+
//~| expected type `Foo<'a, 'b>`
21+
//~| found type `Foo<'b, 'a>`
22+
//~| lifetime mismatch
23+
//~| ERROR mismatched method receiver
24+
//~| expected type `Foo<'a, 'b>`
25+
//~| found type `Foo<'b, 'a>`
26+
//~| lifetime mismatch
27+
) {}
2028
}
2129

2230
fn main() {}

src/test/compile-fail/issue-17740.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//~ ERROR mismatched types
2-
//~| ERROR mismatched types
31
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
42
// file at the top-level directory of this distribution and at
53
// http://rust-lang.org/COPYRIGHT.
@@ -16,6 +14,14 @@ struct Foo<'a> {
1614

1715
impl <'a> Foo<'a>{
1816
fn bar(self: &mut Foo) {
17+
//~^ mismatched method receiver
18+
//~| expected type `Foo<'a>`
19+
//~| found type `Foo<'_>`
20+
//~| lifetime mismatch
21+
//~| mismatched method receiver
22+
//~| expected type `Foo<'a>`
23+
//~| found type `Foo<'_>`
24+
//~| lifetime mismatch
1925
}
2026
}
2127

src/test/compile-fail/ufcs-explicit-self-bad.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
//~ ERROR mismatched types
2-
//~| ERROR mismatched types
3-
//~| ERROR mismatched types
4-
//~| ERROR mismatched types
51
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
62
// file at the top-level directory of this distribution and at
73
// http://rust-lang.org/COPYRIGHT.
@@ -51,8 +47,17 @@ trait SomeTrait {
5147

5248
impl<'a, T> SomeTrait for &'a Bar<T> {
5349
fn dummy1(self: &&'a Bar<T>) { }
54-
fn dummy2(self: &Bar<T>) {}
50+
fn dummy2(self: &Bar<T>) {} //~ ERROR mismatched method receiver
51+
//~^ ERROR mismatched method receiver
5552
fn dummy3(self: &&Bar<T>) {}
53+
//~^ ERROR mismatched method receiver
54+
//~| expected type `&'a Bar<T>`
55+
//~| found type `&Bar<T>`
56+
//~| lifetime mismatch
57+
//~| ERROR mismatched method receiver
58+
//~| expected type `&'a Bar<T>`
59+
//~| found type `&Bar<T>`
60+
//~| lifetime mismatch
5661
}
5762

5863
fn main() {

0 commit comments

Comments
 (0)