rust/tests/ui/autoref-autoderef/auto-ref-sliceable.rs

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

20 lines
281 B
Rust
Raw Normal View History

// run-pass
trait Pushable<T> {
2013-05-08 04:33:31 +00:00
fn push_val(&mut self, t: T);
}
impl<T> Pushable<T> for Vec<T> {
2013-05-08 04:33:31 +00:00
fn push_val(&mut self, t: T) {
2013-02-15 10:44:18 +00:00
self.push(t);
}
}
pub fn main() {
let mut v = vec![1];
v.push_val(2);
v.push_val(3);
2015-02-24 18:15:45 +00:00
assert_eq!(v, [1, 2, 3]);
}