Skip to content

Commit 21d8217

Browse files
committed
---
yaml --- r: 5880 b: refs/heads/master c: 391e121 h: refs/heads/master v: v3
1 parent f3c2069 commit 21d8217

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 342a400e79c44e8035b944129617734009a5abcb
2+
refs/heads/master: 391e12124b4ee96849b8b5959c2cab824400a384

trunk/src/comp/middle/ty.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2004,8 +2004,11 @@ mod unify {
20042004
(ures_err(terr_mode_mismatch(expected_input.mode,
20052005
actual_input.mode)));
20062006
} else { expected_input.mode };
2007+
// The variance changes (flips basically) when descending
2008+
// into arguments of function types
20072009
let result = unify_step(
2008-
cx, expected_input.ty, actual_input.ty, variance);
2010+
cx, expected_input.ty, actual_input.ty,
2011+
variance_transform(variance, contravariant));
20092012
alt result {
20102013
ures_ok(rty) { result_ins += [{mode: result_mode, ty: rty}]; }
20112014
_ { ret fn_common_res_err(result); }
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// error-pattern: mismatched types
2+
3+
// Make sure that fn-to-block coercion isn't incorrectly lifted over
4+
// other tycons.
5+
6+
fn main() {
7+
fn f(f: fn(fn(fn()))) {
8+
}
9+
10+
fn g(f: fn(block())) {
11+
}
12+
13+
f(g);
14+
}

0 commit comments

Comments
 (0)