We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 34b42ee commit af418d9Copy full SHA for af418d9
src/test/run-pass/regions-fn-subtyping.rs
@@ -0,0 +1,24 @@
1
+//xfail-test
2
+
3
+// Issue #2263.
4
5
+// Should pass region checking.
6
+fn ok(f: fn@(x: &uint)) {
7
+ // Here, g is a function that can accept a uint pointer with
8
+ // lifetime r, and f is a function that can accept a uint pointer
9
+ // with any lifetime. The assignment g = f should be OK (i.e., f
10
+ // should be a subtype of g), because f can be used in any context
11
+ // that expects g's type. But this currently fails.
12
+ let mut g: fn@(y: &r.uint) = fn@(x: &r.uint) { };
13
+ g = f;
14
+}
15
16
+// This version is the same as above, except that here, g's type is
17
+// inferred.
18
+fn ok_inferred(f: fn@(x: &uint)) {
19
+ let mut g = fn@(x: &r.uint) { };
20
21
22
23
+fn main() {
24
0 commit comments