summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/issue-51268.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/nll/issue-51268.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/nll/issue-51268.rs b/src/test/ui/nll/issue-51268.rs
new file mode 100644
index 000000000..dcdedf7d4
--- /dev/null
+++ b/src/test/ui/nll/issue-51268.rs
@@ -0,0 +1,21 @@
+struct Bar;
+
+impl Bar {
+ fn bar(&mut self, _: impl Fn()) {}
+}
+
+struct Foo {
+ thing: Bar,
+ number: usize,
+}
+
+impl Foo {
+ fn foo(&mut self) {
+ self.thing.bar(|| {
+ //~^ ERROR cannot borrow `self.thing` as mutable because it is also borrowed as immutable [E0502]
+ &self.number;
+ });
+ }
+}
+
+fn main() {}