]> git.proxmox.com Git - rustc.git/blame - src/test/ui/span/slice-borrow.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / span / slice-borrow.rs
CommitLineData
1a4d82fc 1// Test slicing expressions doesn't defeat the borrow checker.
223e47cc 2
94b46f34 3fn 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
13trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
14impl<T> Fake for T { }