about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-11-16 15:59:44 +0900
committerGitHub <noreply@github.com>2021-11-16 15:59:44 +0900
commitc73b35e05d1b224b91ed90ef4f321e4635732100 (patch)
treef93be4b2ac2bf5d766de8910ba52cb8b5e1ccd6a /src
parent3c1d5779ae625cfd27fb4f4ba581ae5799b7a97a (diff)
parent894c0e41907b581563120516862c8ea85cbb65d9 (diff)
downloadrust-c73b35e05d1b224b91ed90ef4f321e4635732100.tar.gz
rust-c73b35e05d1b224b91ed90ef4f321e4635732100.zip
Rollup merge of #90936 - JohnTitor:issue-80772, r=Mark-Simulacrum
Add a regression test for #80772

Closes #80772
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/borrowck/issue-80772.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/issue-80772.rs b/src/test/ui/borrowck/issue-80772.rs
new file mode 100644
index 00000000000..1b8caa3f8ac
--- /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() {}