mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
27 lines
388 B
Rust
27 lines
388 B
Rust
// error-pattern: reached the recursion limit while auto-dereferencing
|
|
// compile-flags: -Zdeduplicate-diagnostics=yes
|
|
|
|
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);
|
|
x.foo;
|
|
x.bar();
|
|
}
|
|
|
|
Foo.foo;
|
|
Foo.bar();
|
|
}
|