]> git.lizzy.rs Git - rust.git/blob - src/test/ui/infinite/infinite-autoderef.rs
ca26252832bcd5b7a7b48209bdee54b40697650a
[rust.git] / src / test / ui / infinite / infinite-autoderef.rs
1 // error-pattern: reached the recursion limit while auto-dereferencing
2
3
4
5 use std::ops::Deref;
6
7 struct Foo;
8
9 impl Deref for Foo {
10     type Target = Foo;
11
12     fn deref(&self) -> &Foo {
13         self
14     }
15 }
16
17 pub fn main() {
18     let mut x;
19     loop {
20         x = Box::new(x);
21         x.foo;
22         x.bar();
23     }
24
25     Foo.foo;
26     Foo.bar();
27 }