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