about summary refs log tree commit diff
path: root/tests/ui/unique/expr-block-generic-unique1.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-03 07:27:58 +0000
committerbors <bors@rust-lang.org>2023-04-03 07:27:58 +0000
commit932c173ca1b7a79c1005e2d72ddfa505a7bf2cfa (patch)
tree2c44d95b514a02c51806d2e3f38e3fe29c9b07e4 /tests/ui/unique/expr-block-generic-unique1.rs
parentd0eed58a1e78eb1a25bb54076e4b0f7ea5ff7401 (diff)
parent22df7107bdd36cf47e327c8165e720c1eccb351d (diff)
downloadrust-932c173ca1b7a79c1005e2d72ddfa505a7bf2cfa.tar.gz
rust-932c173ca1b7a79c1005e2d72ddfa505a7bf2cfa.zip
Auto merge of #109884 - matthiaskrgr:rollup-5wapig9, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #109526 (LIBPATH is used as dylib's path environment variable on AIX)
 - #109642 (check for missing codegen backeng config)
 - #109722 (Implement read_buf for RustHermit)
 - #109856 (fix(middle): emit error rather than delay bug when reaching limit)
 - #109868 (Improve PR job names in Github Actions preview)
 - #109871 (Include invocation start times)
 - #109873 (Move some UI tests into subdirectories)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/ui/unique/expr-block-generic-unique1.rs')
-rw-r--r--tests/ui/unique/expr-block-generic-unique1.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/unique/expr-block-generic-unique1.rs b/tests/ui/unique/expr-block-generic-unique1.rs
new file mode 100644
index 00000000000..14603a2c71f
--- /dev/null
+++ b/tests/ui/unique/expr-block-generic-unique1.rs
@@ -0,0 +1,18 @@
+// run-pass
+#![allow(unused_braces)]
+
+fn test_generic<T, F>(expected: Box<T>, eq: F) where T: Clone, F: FnOnce(Box<T>, Box<T>) -> bool {
+    let actual: Box<T> = { expected.clone() };
+    assert!(eq(expected, actual));
+}
+
+fn test_box() {
+    fn compare_box(b1: Box<bool>, b2: Box<bool>) -> bool {
+        println!("{}", *b1);
+        println!("{}", *b2);
+        return *b1 == *b2;
+    }
+    test_generic::<bool, _>(Box::new(true), compare_box);
+}
+
+pub fn main() { test_box(); }