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);
|
2024-02-22 18:18:33 +01:00
|
|
|
//~^ ERROR overflow assigning `Box<_>` to `_`
|
2014-03-06 20:37:24 +02:00
|
|
|
x.foo;
|
|
|
|
|
x.bar();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Foo.foo;
|
|
|
|
|
Foo.bar();
|
|
|
|
|
}
|