]> git.lizzy.rs Git - rust.git/blob - tests/ui/span/slice-borrow.rs
Optimize `TyKind::eq`.
[rust.git] / tests / ui / span / slice-borrow.rs
1 // Test slicing expressions doesn't defeat the borrow checker.
2
3 fn main() {
4     let y;
5     {
6         let x: &[isize] = &vec![1, 2, 3, 4, 5];
7         //~^ ERROR temporary value dropped while borrowed
8         y = &x[1..];
9     }
10     y.use_ref();
11 }
12
13 trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { }  }
14 impl<T> Fake for T { }