]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/issue-81365-6.rs
Do not use a suggestion to change a binding's name to a type
[rust.git] / src / test / ui / borrowck / issue-81365-6.rs
1 use std::ops::Deref;
2
3 struct Container {
4     target: Vec<()>,
5     container_field: bool,
6 }
7
8 impl Deref for Container {
9     type Target = [()];
10     fn deref(&self) -> &Self::Target {
11         &self.target
12     }
13 }
14
15 impl Container {
16     fn bad_borrow(&mut self) {
17         let first = &self[0];
18         self.container_field = true; //~ ERROR E0506
19         first;
20     }
21 }
22
23 fn main() {}