summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs')
-rw-r--r--src/test/ui/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs
new file mode 100644
index 000000000..c3abdd8aa
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs
@@ -0,0 +1,23 @@
+// run-pass
+// Test that we are able to infer that the type of `x` is `isize` based
+// on the expected type from the object.
+
+// pretty-expanded FIXME #23616
+
+pub trait ToPrimitive {
+ fn to_int(&self) {}
+}
+
+impl ToPrimitive for isize {}
+impl ToPrimitive for i32 {}
+impl ToPrimitive for usize {}
+
+fn doit<T,F>(val: T, f: &F)
+ where F : Fn(&T)
+{
+ f(&val)
+}
+
+pub fn main() {
+ doit(0, &|x /*: isize*/ | { x.to_int(); });
+}