aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/issue-808.rs
blob: 4186d54f4bc191957842e3e9fbd5b8ed5a4a9ccd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#[lang = "sized"]
pub trait Sized {}

pub trait Foo {
    type Target;

    fn bar(&self) -> &Self::Target;
}

impl<T> Foo for &T {
    type Target = T;

    fn bar(&self) -> &T {
        *self
    }
}

pub fn main() {
    let a: i32 = 123;
    let b: &i32 = &a;

    b.bar();
}