]> git.proxmox.com Git - rustc.git/blame - src/test/ui/borrowck/issue-81365-7.rs
Merge tag 'debian/1.52.1+dfsg1-1_exp2' into proxmox/buster
[rustc.git] / src / test / ui / borrowck / issue-81365-7.rs
CommitLineData
6a06907d
XL
1use std::ops::Deref;
2
3struct DerefTarget {
4 target_field: bool,
5}
6struct Container {
7 target: DerefTarget,
8 container_field: bool,
9}
10
11impl Deref for Container {
12 type Target = DerefTarget;
13 fn deref(&self) -> &Self::Target {
14 &self.target
15 }
16}
17
18fn bad_borrow(c: &mut Container) {
19 let first = &c.target_field;
20 c.container_field = true; //~ ERROR E0506
21 first;
22}
23
24fn main() {}