rust/tests/ui/infinite/infinite-autoderef.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
388 B
Rust
Raw Normal View History

// 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
use std::ops::Deref;
struct Foo;
2015-01-01 13:53:20 -06:00
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();
}