mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
17 lines
221 B
Rust
17 lines
221 B
Rust
//@ run-pass
|
|
|
|
|
|
fn foo(x: &[isize]) -> isize {
|
|
x[0]
|
|
}
|
|
|
|
pub fn main() {
|
|
let p = vec![1,2,3,4,5];
|
|
let r = foo(&p);
|
|
assert_eq!(r, 1);
|
|
|
|
let p = vec![5,4,3,2,1];
|
|
let r = foo(&p);
|
|
assert_eq!(r, 5);
|
|
}
|