Skip to content

Commit 3aa8ddb

Browse files
committed
---
yaml --- r: 5751 b: refs/heads/master c: 5b0f79b h: refs/heads/master i: 5749: 2654173 5747: f0d48e0 5743: a10e102 v: v3
1 parent 24e75ed commit 3aa8ddb

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-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: b2770393252afaca3c9f31b856040618bcb25736
2+
refs/heads/master: 5b0f79b75a40370625383e4fe81bcec5f68ee18d

trunk/src/comp/middle/typeck.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2116,7 +2116,18 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
21162116
}
21172117
i += 1u;
21182118
}
2119-
let ft = ty::mk_fn(tcx, proto, out_args, rt, cf, constrs);
2119+
2120+
// Determine what fn prototype results from binding
2121+
fn lower_bound_proto(proto: ast::proto) -> ast::proto {
2122+
// FIXME: This is right for bare fns, possibly not others
2123+
alt proto {
2124+
ast::proto_bare. { ast::proto_fn }
2125+
_ { proto }
2126+
}
2127+
}
2128+
2129+
let ft = ty::mk_fn(tcx, lower_bound_proto(proto),
2130+
out_args, rt, cf, constrs);
21202131
write::ty_only_fixup(fcx, id, ft);
21212132
}
21222133
ast::expr_call(f, args) {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// error-pattern:mismatched types: expected fn#() but found fn()
2+
3+
fn# f() {
4+
}
5+
6+
fn main() {
7+
// Can't produce a bare function by binding
8+
let g: fn#() = bind f();
9+
}

0 commit comments

Comments
 (0)