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