Skip to content

Commit fef9b59

Browse files
committed
---
yaml --- r: 41959 b: refs/heads/master c: acde90d h: refs/heads/master i: 41957: eafafd7 41955: 6bd356e 41951: 7f7d825 v: v3
1 parent b327dd1 commit fef9b59

File tree

6 files changed

+20
-10
lines changed

6 files changed

+20
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: ce85837557868a2880a888e36df10d199c3e50d9
2+
refs/heads/master: acde90dc1c5d13ccfd24703bddc1e2df4a52ae58
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/src/libcore/hashmap.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ pub mod linear {
6060
((capacity as float) * 3. / 4.) as uint
6161
}
6262

63-
pub fn LinearMap<K:Eq Hash,V>() -> LinearMap<K,V> {
64-
linear_map_with_capacity(INITIAL_CAPACITY)
65-
}
66-
6763
pub fn linear_map_with_capacity<K:Eq Hash,V>(
6864
initial_capacity: uint) -> LinearMap<K,V> {
6965
let r = rand::Rng();
@@ -351,7 +347,7 @@ pub mod linear {
351347
}
352348
}
353349

354-
impl<K:Hash IterBytes Eq,V> LinearMap<K,V> {
350+
pub impl<K:Hash IterBytes Eq,V> LinearMap<K,V> {
355351
static fn new() -> LinearMap<K, V> {
356352
linear_map_with_capacity(INITIAL_CAPACITY)
357353
}
@@ -495,7 +491,7 @@ pub mod linear {
495491

496492
pub impl <T: Hash IterBytes Eq> LinearSet<T> {
497493
/// Create an empty LinearSet
498-
static fn new() -> LinearSet<T> { LinearSet{map: LinearMap()} }
494+
static fn new() -> LinearSet<T> { LinearSet{map: LinearMap::new()} }
499495
}
500496
}
501497

trunk/src/librustc/middle/trans/base.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ 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;
6566
use util::ppaux::{ty_to_str, ty_to_short_str};
6667
use util::ppaux;
6768

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

21912192
// Create a _rust_main(args: ~[str]) function which will be called from the
21922193
// runtime rust_start function
2193-
fn create_main_wrapper(ccx: @crate_ctxt, _sp: span, main_llfn: ValueRef) {
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+
}
21942199

21952200
let llfn = create_main(ccx, main_llfn);
2201+
ccx.main_fn = Some(llfn);
21962202
create_entry_fn(ccx, llfn);
21972203

21982204
fn create_main(ccx: @crate_ctxt, main_llfn: ValueRef) -> ValueRef {
@@ -3002,6 +3008,7 @@ fn trans_crate(sess: session::Session,
30023008
exp_map2: emap2,
30033009
reachable: reachable,
30043010
item_symbols: HashMap(),
3011+
mut main_fn: None::<ValueRef>,
30053012
link_meta: link_meta,
30063013
enum_sizes: ty::new_ty_hash(),
30073014
discrims: HashMap(),

trunk/src/librustc/middle/trans/common.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ 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>,
166167
link_meta: link_meta,
167168
enum_sizes: HashMap<ty::t, uint>,
168169
discrims: HashMap<ast::def_id, ValueRef>,

trunk/src/librustc/util/common.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ 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+
104110
fn pluralize(n: uint, +s: ~str) -> ~str {
105111
if n == 1 { s }
106112
else { str::concat([s, ~"s"]) }

trunk/src/libstd/workcache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ impl Context {
259259
static fn new(db: @Mut<Database>,
260260
lg: @Mut<Logger>,
261261
cfg: @json::Object) -> Context {
262-
Context {db: db, logger: lg, cfg: cfg, freshness: LinearMap()}
262+
Context{db: db, logger: lg, cfg: cfg, freshness: LinearMap::new()}
263263
}
264264
265265
fn prep<T:Owned
@@ -270,7 +270,7 @@ impl Context {
270270
blk: fn(@Mut<Prep>)->Work<T>) -> Work<T> {
271271
let p = @Mut(Prep {ctxt: self,
272272
fn_name: fn_name.to_owned(),
273-
declared_inputs: LinearMap()});
273+
declared_inputs: LinearMap::new()});
274274
blk(p)
275275
}
276276
}

0 commit comments

Comments
 (0)