std: use a `match` in `assert_eq!` to extend the lifetime of the args.

This enables

    assert_eq!(foo.collect::<Vec<...>>().as_slice(), &[1,2,3,4]);

to work, by extending the lifetime of the .as_slice() rvalue.
collections: replace all ~[T] with Vec<T>.
auto merge of #13350 : huonw/rust/devec-collections, r=alexcrichton

collections: replace all ~[T] with Vec<T>.