]>
Commit | Line | Data |
---|---|---|
1a4d82fc | 1 | // Test slicing expressions doesn't defeat the borrow checker. |
223e47cc | 2 | |
94b46f34 | 3 | fn main() { |
1a4d82fc | 4 | let y; |
223e47cc | 5 | { |
3b2f2976 | 6 | let x: &[isize] = &vec![1, 2, 3, 4, 5]; |
48663c56 | 7 | //~^ ERROR temporary value dropped while borrowed |
1a4d82fc | 8 | y = &x[1..]; |
223e47cc | 9 | } |
94b46f34 | 10 | y.use_ref(); |
223e47cc | 11 | } |
94b46f34 XL |
12 | |
13 | trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } | |
14 | impl<T> Fake for T { } |