mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 03:33:59 +00:00
13 lines
249 B
Rust
13 lines
249 B
Rust
// run-pass
|
|
// Test that regionck creates the right region links in the pattern
|
|
// binding of a for loop
|
|
|
|
fn foo<'a>(v: &'a [usize]) -> &'a usize {
|
|
for &ref x in v { return x; }
|
|
unreachable!()
|
|
}
|
|
|
|
fn main() {
|
|
assert_eq!(foo(&[0]), &0);
|
|
}
|