mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
12 lines
250 B
Rust
12 lines
250 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);
|
|
}
|