about summary refs log tree commit diff
path: root/tests/ui/closures
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2025-07-13 16:39:45 -0400
committerOneirical <manchot@videotron.ca>2025-08-10 11:54:15 -0400
commitaa543963c68061d9ca46037071d66a028626ff3f (patch)
tree2d6e7de7e1b2fe2176d81f48a456a05ef1b06dff /tests/ui/closures
parentf8e355c230c6eb7b78ffce6a92fd81f78c890524 (diff)
downloadrust-aa543963c68061d9ca46037071d66a028626ff3f.tar.gz
rust-aa543963c68061d9ca46037071d66a028626ff3f.zip
Rehome tests/ui/issues/ tests [4/?]
Diffstat (limited to 'tests/ui/closures')
-rw-r--r--tests/ui/closures/closure-type-inference-in-context-9129.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/ui/closures/closure-type-inference-in-context-9129.rs b/tests/ui/closures/closure-type-inference-in-context-9129.rs
new file mode 100644
index 00000000000..53ee8faab85
--- /dev/null
+++ b/tests/ui/closures/closure-type-inference-in-context-9129.rs
@@ -0,0 +1,32 @@
+// https://github.com/rust-lang/rust/issues/9129
+//@ run-pass
+#![allow(dead_code)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+
+pub trait bomb { fn boom(&self, _: Ident); }
+pub struct S;
+impl bomb for S { fn boom(&self, _: Ident) { } }
+
+pub struct Ident { name: usize }
+
+macro_rules! int3 { () => ( { } ) }
+
+fn Ident_new() -> Ident {
+    int3!();
+    Ident {name: 0x6789ABCD }
+}
+
+pub fn light_fuse(fld: Box<dyn bomb>) {
+    int3!();
+    let f = || {
+        int3!();
+        fld.boom(Ident_new()); // *** 1
+    };
+    f();
+}
+
+pub fn main() {
+    let b = Box::new(S) as Box<dyn bomb>;
+    light_fuse(b);
+}