2014-03-06 12:37:24 -06:00
|
|
|
// error-pattern: reached the recursion limit while auto-dereferencing
|
2022-03-20 14:02:18 -05:00
|
|
|
// compile-flags: -Zdeduplicate-diagnostics=yes
|
2015-01-07 20:53:58 -06:00
|
|
|
|
2014-03-06 12:37:24 -06:00
|
|
|
use std::ops::Deref;
|
|
|
|
|
|
|
|
struct Foo;
|
|
|
|
|
2015-01-01 13:53:20 -06:00
|
|
|
impl Deref for Foo {
|
|
|
|
type Target = Foo;
|
|
|
|
|
2014-07-17 23:44:59 -05:00
|
|
|
fn deref(&self) -> &Foo {
|
2014-03-06 12:37:24 -06:00
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
let mut x;
|
|
|
|
loop {
|
2021-08-24 19:39:40 -05:00
|
|
|
x = Box::new(x);
|
2014-03-06 12:37:24 -06:00
|
|
|
x.foo;
|
|
|
|
x.bar();
|
|
|
|
}
|
|
|
|
|
|
|
|
Foo.foo;
|
|
|
|
Foo.bar();
|
|
|
|
}
|