parent
b277039325
commit
5b0f79b75a
@ -2116,7 +2116,18 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
|
||||
}
|
||||
i += 1u;
|
||||
}
|
||||
let ft = ty::mk_fn(tcx, proto, out_args, rt, cf, constrs);
|
||||
|
||||
// Determine what fn prototype results from binding
|
||||
fn lower_bound_proto(proto: ast::proto) -> ast::proto {
|
||||
// FIXME: This is right for bare fns, possibly not others
|
||||
alt proto {
|
||||
ast::proto_bare. { ast::proto_fn }
|
||||
_ { proto }
|
||||
}
|
||||
}
|
||||
|
||||
let ft = ty::mk_fn(tcx, lower_bound_proto(proto),
|
||||
out_args, rt, cf, constrs);
|
||||
write::ty_only_fixup(fcx, id, ft);
|
||||
}
|
||||
ast::expr_call(f, args) {
|
||||
|
9
src/test/compile-fail/fn-bare-bind.rs
Normal file
9
src/test/compile-fail/fn-bare-bind.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// error-pattern:mismatched types: expected fn#() but found fn()
|
||||
|
||||
fn# f() {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// Can't produce a bare function by binding
|
||||
let g: fn#() = bind f();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user