From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../ui/borrowck/borrowck-insert-during-each.rs | 26 ---------------------- 1 file changed, 26 deletions(-) delete mode 100644 src/test/ui/borrowck/borrowck-insert-during-each.rs (limited to 'src/test/ui/borrowck/borrowck-insert-during-each.rs') diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.rs b/src/test/ui/borrowck/borrowck-insert-during-each.rs deleted file mode 100644 index df967e611..000000000 --- a/src/test/ui/borrowck/borrowck-insert-during-each.rs +++ /dev/null @@ -1,26 +0,0 @@ -use std::collections::HashSet; - -struct Foo { - n: HashSet, -} - -impl Foo { - pub fn foo(&mut self, mut fun: F) where F: FnMut(&isize) { - for f in &self.n { - fun(f); - } - } -} - -fn bar(f: &mut Foo) { - f.foo( - //~^ ERROR cannot borrow `*f` as mutable - |a| { //~ ERROR closure requires unique access to `f` - f.n.insert(*a); - }) -} - -fn main() { - let mut f = Foo { n: HashSet::new() }; - bar(&mut f); -} -- cgit v1.2.3