]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-44405.rs
Merge commit '91496c2ac6abf6454c413bb23e8becf6b6dc20ea' into clippyup
[rust.git] / src / test / ui / issues / issue-44405.rs
1 use std::ops::Index;
2
3 struct Test;
4 struct Container(Test);
5
6 impl Test {
7     fn test(&mut self) {}
8 }
9
10 impl<'a> Index<&'a bool> for Container {
11     type Output = Test;
12
13     fn index(&self, _index: &'a bool) -> &Test {
14         &self.0
15     }
16 }
17
18 fn main() {
19     let container = Container(Test);
20     let mut val = true;
21     container[&mut val].test(); //~ ERROR: cannot borrow data
22 }