]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-48276.rs
Merge commit '6ed6f1e6a1a8f414ba7e6d9b8222e7e5a1686e42' into clippyup
[rust.git] / src / test / ui / issues / issue-48276.rs
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(){}