]>
Commit | Line | Data |
---|---|---|
0531ce1d XL |
1 | // Regression test for issue #48276 - ICE when self type does not match what is |
2 | // required by a trait and regions are involved. | |
3 | ||
4 | trait MyFrom<A> { | |
5 | fn from(a: A) -> Self; | |
6 | } | |
7 | ||
8 | struct A; | |
9 | ||
10 | impl<'a, 'b> MyFrom<A> for &'a str { | |
11 | fn from(self: &'a Self) -> &'b str { | |
12 | //~^ ERROR: method `from` has a `&self` declaration in the impl, but not in the trait | |
13 | "asdf" | |
14 | } | |
15 | } | |
16 | ||
17 | struct B; | |
18 | ||
19 | impl From<A> for B { | |
20 | fn from(&self) -> B { | |
21 | //~^ ERROR: method `from` has a `&self` declaration in the impl, but not in the trait | |
22 | B | |
23 | } | |
24 | } | |
25 | ||
26 | impl From<A> for &'static str { | |
27 | fn from(&self) -> &'static str { | |
28 | //~^ ERROR: method `from` has a `&self` declaration in the impl, but not in the trait | |
29 | "" | |
30 | } | |
31 | } | |
32 | ||
33 | fn main(){} |