rust/tests/ui/error-codes/E0505.rs

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

16 lines
276 B
Rust
Raw Normal View History

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