2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2014-03-05 17:28:08 -06:00
|
|
|
|
2015-03-22 15:13:15 -05:00
|
|
|
|
2014-07-17 23:44:59 -05:00
|
|
|
fn view<T>(x: &[T]) -> &[T] {x}
|
2012-07-06 11:14:57 -05:00
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2016-10-29 16:54:04 -05:00
|
|
|
let v = vec![1, 2, 3];
|
2015-02-01 20:53:25 -06:00
|
|
|
let x = view(&v);
|
|
|
|
let y = view(x);
|
2014-10-15 01:05:01 -05:00
|
|
|
assert!((v[0] == x[0]) && (v[0] == y[0]));
|
2012-07-06 11:14:57 -05:00
|
|
|
}
|