Skip to content

Commit 43eb5f0

Browse files
committedJun 1, 2012
More tests wrt #2263.
1 parent 9a89a75 commit 43eb5f0

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Issue #2263.
2+
3+
// Here, `f` is a function that takes a pointer `x` and a function
4+
// `g`, where `g` requires its argument `y` to be in the same region
5+
// that `x` is in.
6+
fn has_same_region(f: fn(x: &a.int, g: fn(y: &a.int))) {
7+
// Somewhat counterintuitively, this fails because, in
8+
// `wants_two_regions`, the `g` argument needs to be able to
9+
// accept any region. That is, the type that `has_same_region`
10+
// expects is *not* a subtype of the type that `wants_two_regions`
11+
// expects.
12+
wants_two_regions(f); //! ERROR mismatched types
13+
}
14+
15+
fn wants_two_regions(_f: fn(x: &int, g: fn(y: &int))) {
16+
}
17+
18+
fn main() {
19+
}
20+
21+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// xfail-test
2+
3+
// Issue #2263.
4+
5+
// Here, `f` is a function that takes a pointer `x` and a function
6+
// `g`, where `g` requires its argument `y` to be in the same region
7+
// that `x` is in.
8+
fn has_same_region(f: fn(x: &a.int, g: fn(y: &a.int))) {
9+
// `f` should be the type that `wants_same_region` wants, but
10+
// right now the compiler complains that it isn't.
11+
wants_same_region(f);
12+
}
13+
14+
fn wants_same_region(_f: fn(x: &b.int, g: fn(y: &b.int))) {
15+
}
16+
17+
fn main() {
18+
}
19+
20+

0 commit comments

Comments
 (0)
Please sign in to comment.