rust/tests/ui/regions/regions-infer-borrow-scope-view.rs

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

12 lines
182 B
Rust
Raw Normal View History

// run-pass
fn view<T>(x: &[T]) -> &[T] {x}
2012-07-06 11:14:57 -05:00
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]));
2012-07-06 11:14:57 -05:00
}