Skip to content

Commit 78034aa

Browse files
committed
rustc: Add trans_crust_fn. Don't do anything special yet
1 parent d7c8cac commit 78034aa

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/comp/middle/trans/base.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4465,15 +4465,19 @@ fn trans_item(ccx: @crate_ctxt, item: ast::item) {
44654465
};
44664466
alt item.node {
44674467
ast::item_fn(decl, tps, body) {
4468-
alt ccx.item_ids.find(item.id) {
4469-
some(llfndecl) {
4470-
trans_fn(ccx, *path + [path_name(item.ident)], decl, body,
4471-
llfndecl, no_self, tps, none, item.id);
4472-
}
4468+
let llfndecl = alt ccx.item_ids.find(item.id) {
4469+
some(llfndecl) { llfndecl }
44734470
_ {
44744471
ccx.sess.span_fatal(item.span,
44754472
"unbound function item in trans_item");
44764473
}
4474+
};
4475+
if decl.purity != ast::crust_fn {
4476+
trans_fn(ccx, *path + [path_name(item.ident)], decl, body,
4477+
llfndecl, no_self, tps, none, item.id);
4478+
} else {
4479+
native::trans_crust_fn(ccx, *path + [path_name(item.ident)],
4480+
decl, body, llfndecl, item.id);
44774481
}
44784482
}
44794483
ast::item_impl(tps, _, _, ms) {

src/comp/middle/trans/native.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import common::*;
77
import build::*;
88
import base::*;
99

10-
export link_name, trans_native_mod;
10+
export link_name, trans_native_mod, trans_crust_fn;
1111

1212
fn link_name(i: @ast::native_item) -> str {
1313
alt attr::get_meta_item_value_str_by_name(i.attrs, "link_name") {
@@ -189,3 +189,8 @@ fn trans_native_mod(ccx: @crate_ctxt,
189189
}
190190
}
191191
}
192+
193+
fn trans_crust_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
194+
body: ast::blk, llfndecl: ValueRef, id: ast::node_id) {
195+
trans_fn(ccx, path, decl, body, llfndecl, no_self, [], none, id)
196+
}

0 commit comments

Comments
 (0)