]> git.proxmox.com Git - rustc.git/blob - tests/ui/nll/issue-53773.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / nll / issue-53773.rs
1 struct Archive;
2 struct ArchiveIterator<'a> {
3 x: &'a Archive,
4 }
5 struct ArchiveChild<'a> {
6 x: &'a Archive,
7 }
8
9 struct A {
10 raw: &'static mut Archive,
11 }
12 struct Iter<'a> {
13 raw: &'a mut ArchiveIterator<'a>,
14 }
15 struct C<'a> {
16 raw: &'a mut ArchiveChild<'a>,
17 }
18
19 impl A {
20 pub fn iter(&self) -> Iter<'_> {
21 panic!()
22 }
23 }
24 impl Drop for A {
25 fn drop(&mut self) {}
26 }
27 impl<'a> Drop for C<'a> {
28 fn drop(&mut self) {}
29 }
30
31 impl<'a> Iterator for Iter<'a> {
32 type Item = C<'a>;
33 fn next(&mut self) -> Option<C<'a>> {
34 panic!()
35 }
36 }
37
38 fn error(archive: &A) {
39 let mut members: Vec<&mut ArchiveChild<'_>> = vec![];
40 for child in archive.iter() {
41 members.push(child.raw);
42 //~^ ERROR borrow may still be in use when destructor runs [E0713]
43 }
44 members.len();
45 }
46
47 fn main() {}