2016-08-25 17:14:20 -05:00
|
|
|
struct Value {}
|
|
|
|
|
|
|
|
fn eat(val: Value) {}
|
|
|
|
|
2018-05-25 05:36:58 -05:00
|
|
|
fn main() {
|
2016-08-25 17:14:20 -05:00
|
|
|
let x = Value{};
|
|
|
|
{
|
|
|
|
let _ref_to_val: &Value = &x;
|
|
|
|
eat(x); //~ ERROR E0505
|
2018-05-25 05:36:58 -05:00
|
|
|
_ref_to_val.use_ref();
|
2016-08-25 17:14:20 -05:00
|
|
|
}
|
|
|
|
}
|
2018-05-25 05:36:58 -05:00
|
|
|
|
|
|
|
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
|
|
|
|
impl<T> Fake for T { }
|