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-07 23:33:31 -05:00
fn push_val(&mut self, t: T);
}
impl<T> Pushable<T> for Vec<T> {
2013-05-07 23:33:31 -05:00
fn push_val(&mut self, t: T) {
2013-02-15 04:44:18 -06:00
self.push(t);
}
}
pub fn main() {
let mut v = vec![1];
v.push_val(2);
v.push_val(3);
2015-02-24 12:15:45 -06:00
assert_eq!(v, [1, 2, 3]);
}