Skip to content

Commit c0cc37b

Browse files
committed
remove useless rust_main wrapper
the real entry point will now pass the user's main function directly to the scheduler
1 parent 4dc3a97 commit c0cc37b

File tree

1 file changed

+1
-27
lines changed

1 file changed

+1
-27
lines changed

src/librustc/middle/trans/base.rs

+1-27
Original file line numberDiff line numberDiff line change
@@ -2388,38 +2388,12 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
23882388
let et = ccx.sess.entry_type.unwrap();
23892389
match et {
23902390
session::EntryMain => {
2391-
let llfn = create_main(ccx, main_llfn);
2392-
create_entry_fn(ccx, llfn, true);
2391+
create_entry_fn(ccx, main_llfn, true);
23932392
}
23942393
session::EntryStart => create_entry_fn(ccx, main_llfn, false),
23952394
session::EntryNone => {} // Do nothing.
23962395
}
23972396

2398-
fn create_main(ccx: @mut CrateContext, main_llfn: ValueRef) -> ValueRef {
2399-
let nt = ty::mk_nil();
2400-
let llfty = type_of_rust_fn(ccx, [], nt);
2401-
let llfdecl = decl_fn(ccx.llmod, "_rust_main",
2402-
lib::llvm::CCallConv, llfty);
2403-
2404-
let fcx = new_fn_ctxt(ccx, ~[], llfdecl, nt, None);
2405-
2406-
// the args vector built in create_entry_fn will need
2407-
// be updated if this assertion starts to fail.
2408-
assert!(!fcx.caller_expects_out_pointer);
2409-
2410-
let bcx = fcx.entry_bcx.unwrap();
2411-
// Call main.
2412-
let llenvarg = unsafe {
2413-
let env_arg = fcx.env_arg_pos();
2414-
llvm::LLVMGetParam(llfdecl, env_arg as c_uint)
2415-
};
2416-
let args = ~[llenvarg];
2417-
Call(bcx, main_llfn, args, []);
2418-
2419-
finish_fn(fcx, bcx);
2420-
return llfdecl;
2421-
}
2422-
24232397
fn create_entry_fn(ccx: @mut CrateContext,
24242398
rust_main: ValueRef,
24252399
use_start_lang_item: bool) {

0 commit comments

Comments
 (0)