rust/tests/ui/issues/issue-17068.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
250 B
Rust
Raw Normal View History

//@ run-pass
2014-11-08 19:04:37 +00:00
// Test that regionck creates the right region links in the pattern
// binding of a for loop
fn foo<'a>(v: &'a [usize]) -> &'a usize {
2015-01-31 17:20:46 +00:00
for &ref x in v { return x; }
2014-11-08 19:04:37 +00:00
unreachable!()
}
fn main() {
assert_eq!(foo(&[0]), &0);
}