]> git.proxmox.com Git - rustc.git/blame - src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / borrowck / borrowck-move-from-subpath-of-borrowed-path.rs
CommitLineData
1a4d82fc
JJ
1// verify that an error is raised when trying to move out of a
2// borrowed path.
223e47cc 3
b7449926
XL
4
5
c295e0f8 6
223e47cc
LB
7
8fn main() {
c295e0f8 9 let a: Box<Box<_>> = Box::new(Box::new(2));
1a4d82fc
JJ
10 let b = &a;
11
12 let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed
b7449926 13 b.use_ref();
223e47cc 14}
b7449926
XL
15
16trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
17impl<T> Fake for T { }