There was an error while loading. Please reload this page.
1 parent dd51031 commit 9f0239cCopy full SHA for 9f0239c
src/test/compile-fail/mode-inference-fail.rs
@@ -0,0 +1,11 @@
1
+// In this test, the mode gets inferred to ++ due to the apply_int(),
2
+// but then we get a failure in the generic apply().
3
+
4
+fn apply<A>(f: fn(A) -> A, a: A) -> A { f(a) }
5
+fn apply_int(f: fn(int) -> int, a: int) -> int { f(a) }
6
7
+fn main() {
8
+ let f = {|i| i};
9
+ assert apply_int(f, 2) == 2;
10
+ assert apply(f, 2) == 2; //! ERROR expected argument mode ++
11
+}
0 commit comments