mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
12 lines
183 B
Rust
12 lines
183 B
Rust
//@ run-pass
|
|
|
|
|
|
fn view<T>(x: &[T]) -> &[T] {x}
|
|
|
|
pub fn main() {
|
|
let v = vec![1, 2, 3];
|
|
let x = view(&v);
|
|
let y = view(x);
|
|
assert!((v[0] == x[0]) && (v[0] == y[0]));
|
|
}
|