]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-48276.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / issues / issue-48276.rs
CommitLineData
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
4trait MyFrom<A> {
5 fn from(a: A) -> Self;
6}
7
8struct A;
9
10impl<'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
17struct B;
18
19impl 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
26impl 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
33fn main(){}