about summary refs log tree commit diff
path: root/tests/ui/infinite/infinite-autoderef.rs
blob: ef6ba8ac87b7bf20222254da0e030cac7d0b31ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::ops::Deref;

struct Foo;

impl Deref for Foo {
    type Target = Foo;

    fn deref(&self) -> &Foo {
        self
    }
}

pub fn main() {
    let mut x;
    loop {
        x = Box::new(x);
        //~^ ERROR overflow assigning `Box<_>` to `_`
        x.foo;
        x.bar();
    }

    Foo.foo;
    Foo.bar();
}