]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/slice-borrow.rs
Merge commit 'dbee13661efa269cb4cd57bb4c6b99a19732b484' into sync_cg_clif-2020-12-27
[rust.git] / src / test / 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 { }