Skip to content

Commit ce954d1

Browse files
committed
Merge pull request #4611 from ILyoan/i4482_more
Remove unnecessary code
2 parents 8b2e7fc + ce85837 commit ce954d1

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

src/librustc/middle/trans/base.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ use middle::trans::shape::*;
6262
use middle::trans::tvec;
6363
use middle::trans::type_of::*;
6464
use util::common::indenter;
65-
use util::common::is_main_name;
6665
use util::ppaux::{ty_to_str, ty_to_short_str};
6766
use util::ppaux;
6867

@@ -2191,14 +2190,9 @@ fn is_main_fn(sess: &Session, node_id: ast::node_id) -> bool {
21912190

21922191
// Create a _rust_main(args: ~[str]) function which will be called from the
21932192
// runtime rust_start function
2194-
fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef) {
2195-
2196-
if ccx.main_fn != None::<ValueRef> {
2197-
ccx.sess.span_fatal(sp, ~"multiple 'main' functions");
2198-
}
2193+
fn create_main_wrapper(ccx: @crate_ctxt, _sp: span, main_llfn: ValueRef) {
21992194

22002195
let llfn = create_main(ccx, main_llfn);
2201-
ccx.main_fn = Some(llfn);
22022196
create_entry_fn(ccx, llfn);
22032197

22042198
fn create_main(ccx: @crate_ctxt, main_llfn: ValueRef) -> ValueRef {
@@ -3008,7 +3002,6 @@ fn trans_crate(sess: session::Session,
30083002
exp_map2: emap2,
30093003
reachable: reachable,
30103004
item_symbols: HashMap(),
3011-
mut main_fn: None::<ValueRef>,
30123005
link_meta: link_meta,
30133006
enum_sizes: ty::new_ty_hash(),
30143007
discrims: HashMap(),

src/librustc/middle/trans/common.rs

-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ struct crate_ctxt {
163163
exp_map2: resolve::ExportMap2,
164164
reachable: reachable::map,
165165
item_symbols: HashMap<ast::node_id, ~str>,
166-
mut main_fn: Option<ValueRef>,
167166
link_meta: link_meta,
168167
enum_sizes: HashMap<ty::t, uint>,
169168
discrims: HashMap<ast::def_id, ValueRef>,

src/librustc/util/common.rs

-6
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,6 @@ fn local_rhs_span(l: @ast::local, def: span) -> span {
101101
}
102102
}
103103

104-
fn is_main_name(path: syntax::ast_map::path) -> bool {
105-
vec::last(path) == syntax::ast_map::path_name(
106-
syntax::parse::token::special_idents::main
107-
)
108-
}
109-
110104
fn pluralize(n: uint, +s: ~str) -> ~str {
111105
if n == 1 { s }
112106
else { str::concat([s, ~"s"]) }

0 commit comments

Comments
 (0)