Skip to content

Commit 0c75305

Browse files
committed
---
yaml --- r: 51169 b: refs/heads/try c: eadd358 h: refs/heads/master i: 51167: 356ad95 v: v3
1 parent 2b63ebe commit 0c75305

File tree

8 files changed

+60
-8
lines changed

8 files changed

+60
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 5f13e9ccc2e3328d4cd8ca49f84e6840dd998346
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f7a2371c176663d59062ec5158f39faecba45768
5-
refs/heads/try: bd7ba1fa62e5569a1a7c6335ff7b2a334cff2ad0
5+
refs/heads/try: eadd358b2a35a64ed91565ce436469089aa9e718
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/core.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ pub mod container;
189189
pub mod option;
190190
pub mod result;
191191
pub mod either;
192+
pub mod dlist;
192193
pub mod hashmap;
193194
pub mod cell;
194195
pub mod trie;

branches/try/src/libstd/dlist.rs renamed to branches/try/src/libcore/dlist.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ Do not use ==, !=, <, etc on doubly-linked lists -- it may not terminate.
1818
1919
*/
2020

21-
use core::prelude::*;
22-
use core::managed;
21+
use iter;
22+
use iter::BaseIter;
23+
use kinds::Copy;
24+
use managed;
25+
use option::{None, Option, Some};
26+
use vec;
2327

2428
pub type DListLink<T> = Option<@mut DListNode<T>>;
2529

@@ -536,8 +540,10 @@ impl<T> BaseIter<T> for @mut DList<T> {
536540

537541
#[cfg(test)]
538542
mod tests {
539-
use super::*;
540-
use core::prelude::*;
543+
use dlist::{DList, concat, from_vec, new_dlist_node};
544+
use iter;
545+
use option::{None, Some};
546+
use vec;
541547

542548
#[test]
543549
pub fn test_dlist_concat() {

branches/try/src/libcore/rt/mod.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ mod context;
4848
mod thread;
4949
pub mod env;
5050

51+
#[cfg(stage0)]
5152
pub fn start(main: *u8, _argc: int, _argv: *c_char, _crate_map: *u8) -> int {
5253
use self::sched::{Scheduler, Task};
5354
use self::uvio::UvEventLoop;
@@ -67,3 +68,22 @@ pub fn start(main: *u8, _argc: int, _argv: *c_char, _crate_map: *u8) -> int {
6768
}
6869
}
6970

71+
#[cfg(not(stage0))]
72+
pub fn start(main: *u8, _argc: int, _argv: **c_char, _crate_map: *u8) -> int {
73+
use self::sched::{Scheduler, Task};
74+
use self::uvio::UvEventLoop;
75+
76+
let loop_ = ~UvEventLoop::new();
77+
let mut sched = ~Scheduler::new(loop_);
78+
let main_task = ~do Task::new(&mut sched.stack_pool) {
79+
// XXX: Can't call a C function pointer from Rust yet
80+
unsafe { rust_call_nullary_fn(main) };
81+
};
82+
sched.task_queue.push_back(main_task);
83+
sched.run();
84+
return 0;
85+
86+
extern {
87+
fn rust_call_nullary_fn(f: *u8);
88+
}
89+
}

branches/try/src/libcore/unstable/lang.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ pub unsafe fn strdup_uniq(ptr: *c_uchar, len: uint) -> ~str {
127127
}
128128

129129
#[lang="start"]
130+
#[cfg(stage0)]
130131
pub fn start(main: *u8, argc: int, argv: *c_char,
131132
crate_map: *u8) -> int {
132133
use libc::getenv;
@@ -150,6 +151,31 @@ pub fn start(main: *u8, argc: int, argv: *c_char,
150151
}
151152
}
152153

154+
#[lang="start"]
155+
#[cfg(not(stage0))]
156+
pub fn start(main: *u8, argc: int, argv: **c_char,
157+
crate_map: *u8) -> int {
158+
use libc::getenv;
159+
use rt::start;
160+
161+
unsafe {
162+
let use_new_rt = do str::as_c_str("RUST_NEWRT") |s| {
163+
getenv(s).is_null()
164+
};
165+
if use_new_rt {
166+
return rust_start(main as *c_void, argc as c_int, argv,
167+
crate_map as *c_void) as int;
168+
} else {
169+
return start(main, argc, argv, crate_map);
170+
}
171+
}
172+
173+
extern {
174+
fn rust_start(main: *c_void, argc: c_int, argv: **c_char,
175+
crate_map: *c_void) -> c_int;
176+
}
177+
}
178+
153179
// Local Variables:
154180
// mode: rust;
155181
// fill-column: 78;

branches/try/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2247,7 +2247,7 @@ pub fn create_main_wrapper(ccx: @CrateContext,
22472247
fn main_name() -> ~str { return ~"WinMain@16"; }
22482248
#[cfg(unix)]
22492249
fn main_name() -> ~str { return ~"main"; }
2250-
let llfty = T_fn(~[ccx.int_type, T_ptr(T_i8())], ccx.int_type);
2250+
let llfty = T_fn(~[ccx.int_type, T_ptr(T_ptr(T_i8()))], ccx.int_type);
22512251
22522252
// FIXME #4404 android JNI hacks
22532253
let llfn = if *ccx.sess.building_library {

branches/try/src/libstd/serialize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ Core encoding and decoding interfaces.
1717
#[forbid(non_camel_case_types)];
1818

1919
use core::prelude::*;
20+
use core::dlist::DList;
2021
use core::hashmap::linear::{LinearMap, LinearSet};
2122
use core::trie::{TrieMap, TrieSet};
2223
use deque::Deque;
23-
use dlist::DList;
2424
use treemap::{TreeMap, TreeSet};
2525

2626
pub trait Encoder {

branches/try/src/libstd/std.rc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ pub mod priority_queue;
7575
pub mod rope;
7676
pub mod smallintmap;
7777
pub mod sort;
78-
pub mod dlist;
7978
pub mod treemap;
8079

8180
// And ... other stuff

0 commit comments

Comments
 (0)