mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
25 lines
322 B
Rust
25 lines
322 B
Rust
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);
|
|
//~^ ERROR overflow assigning `Box<_>` to `_`
|
|
x.foo;
|
|
x.bar();
|
|
}
|
|
|
|
Foo.foo;
|
|
Foo.bar();
|
|
}
|