From 894c0e41907b581563120516862c8ea85cbb65d9 Mon Sep 17 00:00:00 2001
From: Yuki Okushi <yuki.okushi@huawei.com>
Date: Tue, 16 Nov 2021 09:38:43 +0900
Subject: [PATCH] Add a regression test for #80772

---
 src/test/ui/borrowck/issue-80772.rs | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 src/test/ui/borrowck/issue-80772.rs

diff --git a/src/test/ui/borrowck/issue-80772.rs b/src/test/ui/borrowck/issue-80772.rs
new file mode 100644
index 0000000000000..1b8caa3f8ac8b
--- /dev/null
+++ b/src/test/ui/borrowck/issue-80772.rs
@@ -0,0 +1,21 @@
+// check-pass
+
+trait SomeTrait {}
+
+pub struct Exhibit {
+    constant: usize,
+    factory: fn(&usize) -> Box<dyn SomeTrait>,
+}
+
+pub const A_CONSTANT: &[Exhibit] = &[
+    Exhibit {
+        constant: 1,
+        factory: |_| unimplemented!(),
+    },
+    Exhibit {
+        constant: "Hello world".len(),
+        factory: |_| unimplemented!(),
+    },
+];
+
+fn main() {}