Skip to content

Commit f10a5bb

Browse files
committed
rustc: Make type_of() return the type of the wrapper for native functions. lib-map now compiles, but fails to work properly.
1 parent bd9f454 commit f10a5bb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/comp/middle/trans.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ fn type_of_inner(@crate_ctxt cx, @ty.t t, bool boxed) -> TypeRef {
705705
llty = T_fn_pair(cx.tn, type_of_fn(cx, proto, args, out, 0u));
706706
}
707707
case (ty.ty_native_fn(?abi, ?args, ?out)) {
708-
auto nft = type_of_native_fn(cx, abi, args, out, 0u);
708+
auto nft = native_fn_wrapper_type(cx, 0u, t);
709709
llty = T_fn_pair(cx.tn, nft);
710710
}
711711
case (ty.ty_obj(?meths)) {
@@ -6101,9 +6101,8 @@ fn native_fn_ty_param_count(@crate_ctxt cx, &ast.def_id id) -> uint {
61016101
ret count;
61026102
}
61036103

6104-
fn native_fn_wrapper_type(@crate_ctxt cx, uint ty_param_count, &ast.ann ann)
6104+
fn native_fn_wrapper_type(@crate_ctxt cx, uint ty_param_count, @ty.t x)
61056105
-> TypeRef {
6106-
auto x = node_ann_type(cx, ann);
61076106
alt (x.struct) {
61086107
case (ty.ty_native_fn(?abi, ?args, ?out)) {
61096108
ret type_of_fn(cx, ast.proto_fn, args, out, ty_param_count);
@@ -6119,7 +6118,8 @@ fn decl_native_fn_and_pair(@crate_ctxt cx,
61196118
auto num_ty_param = native_fn_ty_param_count(cx, id);
61206119

61216120
// Declare the wrapper.
6122-
auto wrapper_type = native_fn_wrapper_type(cx, num_ty_param, ann);
6121+
auto t = node_ann_type(cx, ann);
6122+
auto wrapper_type = native_fn_wrapper_type(cx, num_ty_param, t);
61236123
let str s = mangle_name_by_seq(cx, "wrapper");
61246124
let ValueRef wrapper_fn = decl_internal_fastcall_fn(cx.llmod, s,
61256125
wrapper_type);

0 commit comments

Comments
 (0)