From ce85837557868a2880a888e36df10d199c3e50d9 Mon Sep 17 00:00:00 2001 From: ILyoan Date: Thu, 24 Jan 2013 19:01:21 +0900 Subject: [PATCH] remove unnecessary code --- src/librustc/middle/trans/base.rs | 9 +-------- src/librustc/middle/trans/common.rs | 1 - src/librustc/util/common.rs | 6 ------ 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 5b7453ebf4c..6aed737ba33 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -62,7 +62,6 @@ use middle::trans::shape::*; use middle::trans::tvec; use middle::trans::type_of::*; use util::common::indenter; -use util::common::is_main_name; use util::ppaux::{ty_to_str, ty_to_short_str}; use util::ppaux; @@ -2191,14 +2190,9 @@ fn is_main_fn(sess: &Session, node_id: ast::node_id) -> bool { // Create a _rust_main(args: ~[str]) function which will be called from the // runtime rust_start function -fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef) { - - if ccx.main_fn != None:: { - ccx.sess.span_fatal(sp, ~"multiple 'main' functions"); - } +fn create_main_wrapper(ccx: @crate_ctxt, _sp: span, main_llfn: ValueRef) { let llfn = create_main(ccx, main_llfn); - ccx.main_fn = Some(llfn); create_entry_fn(ccx, llfn); fn create_main(ccx: @crate_ctxt, main_llfn: ValueRef) -> ValueRef { @@ -3008,7 +3002,6 @@ fn trans_crate(sess: session::Session, exp_map2: emap2, reachable: reachable, item_symbols: HashMap(), - mut main_fn: None::, link_meta: link_meta, enum_sizes: ty::new_ty_hash(), discrims: HashMap(), diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 468baa1d8a7..0128876a898 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -163,7 +163,6 @@ struct crate_ctxt { exp_map2: resolve::ExportMap2, reachable: reachable::map, item_symbols: HashMap, - mut main_fn: Option, link_meta: link_meta, enum_sizes: HashMap, discrims: HashMap, diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 2bedbc93b6d..2017af05e35 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -101,12 +101,6 @@ fn local_rhs_span(l: @ast::local, def: span) -> span { } } -fn is_main_name(path: syntax::ast_map::path) -> bool { - vec::last(path) == syntax::ast_map::path_name( - syntax::parse::token::special_idents::main - ) -} - fn pluralize(n: uint, +s: ~str) -> ~str { if n == 1 { s } else { str::concat([s, ~"s"]) }