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

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

25 lines
322 B
Rust
Raw Normal View History

use std::ops::Deref;
struct Foo;
2015-01-01 19:53:20 +00:00
impl Deref for Foo {
type Target = Foo;
fn deref(&self) -> &Foo {
self
}
}
pub fn main() {
let mut x;
loop {
x = Box::new(x);
//~^ ERROR overflow assigning `Box<_>` to `_`
x.foo;
x.bar();
}
Foo.foo;
Foo.bar();
}