Skip to content

Commit 36a2888

Browse files
committed
---
yaml --- r: 145255 b: refs/heads/try2 c: 4757631 h: refs/heads/master i: 145253: d295f2f 145251: b58329a 145247: 9563cea v: v3
1 parent 83648e1 commit 36a2888

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2396
-2052
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 3c0013134cecbe9592f02ed5c6a94c06effb19d4
8+
refs/heads/try2: 47576313695170013cfe07d57e81c2e879a14c14
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/platform.mk

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ CFG_PATH_MUNGE_mips-unknown-linux-gnu := true
343343
CFG_LDPATH_mips-unknown-linux-gnu :=
344344
CFG_RUN_mips-unknown-linux-gnu=
345345
CFG_RUN_TARG_mips-unknown-linux-gnu=
346-
RUSTC_FLAGS_mips-unknown-linux-gnu := --linker=$(CXX_mips-unknown-linux-gnu) --target-cpu mips32r2 --target-feature +mips32r2,+o32
347346

348347
# i686-pc-mingw32 configuration
349348
CC_i686-pc-mingw32=$(CC)
@@ -481,7 +480,7 @@ define CFG_MAKE_TOOLCHAIN
481480
$$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \
482481
$$(call CFG_INSTALL_NAME_$(1),$$(4))
483482

484-
ifeq ($$(findstring $(HOST_$(1)),arm mips),)
483+
ifneq ($(HOST_$(1)),arm)
485484

486485
# We're using llvm-mc as our assembler because it supports
487486
# .cfi pseudo-ops on mac
@@ -493,7 +492,7 @@ define CFG_MAKE_TOOLCHAIN
493492
-o=$$(1)
494493
else
495494

496-
# For the ARM and MIPS crosses, use the toolchain assembler
495+
# For the ARM crosses, use the toolchain assembler
497496
# XXX: We should be able to use the LLVM assembler
498497
CFG_ASSEMBLE_$(1)=$$(CC_$(1)) $$(CFG_DEPEND_FLAGS) $$(2) -c -o $$(1)
499498

branches/try2/mk/rt.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ RUNTIME_CXXS_$(1)_$(2) := \
7171
rt/sync/lock_and_signal.cpp \
7272
rt/sync/rust_thread.cpp \
7373
rt/rust_builtin.cpp \
74+
rt/rust_run_program.cpp \
7475
rt/rust_rng.cpp \
7576
rt/rust_upcall.cpp \
7677
rt/rust_uv.cpp \

branches/try2/src/compiletest/compiletest.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ extern mod extra;
1717

1818
use std::os;
1919
use std::rt;
20+
use std::f64;
2021

2122
use extra::getopts;
2223
use extra::getopts::groups::{optopt, optflag, reqopt};
@@ -130,7 +131,7 @@ pub fn parse_config(args: ~[~str]) -> config {
130131
ratchet_noise_percent:
131132
getopts::opt_maybe_str(matches,
132133
"ratchet-noise-percent").map_move(|s|
133-
from_str::<f64>(s).unwrap()),
134+
f64::from_str(s).unwrap()),
134135
runtool: getopts::opt_maybe_str(matches, "runtool"),
135136
rustcflags: getopts::opt_maybe_str(matches, "rustcflags"),
136137
jit: getopts::opt_present(matches, "jit"),

branches/try2/src/libextra/glob.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ fn list_dir_sorted(path: &Path) -> ~[Path] {
137137
/**
138138
* A compiled Unix shell style pattern.
139139
*/
140+
#[cfg(stage0)]
141+
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes)]
142+
pub struct Pattern {
143+
priv tokens: ~[PatternToken]
144+
}
145+
146+
/**
147+
* A compiled Unix shell style pattern.
148+
*/
149+
#[cfg(not(stage0))]
140150
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes, Default)]
141151
pub struct Pattern {
142152
priv tokens: ~[PatternToken]
@@ -455,10 +465,39 @@ fn is_sep(c: char) -> bool {
455465
}
456466
}
457467
468+
/**
469+
* Configuration options to modify the behaviour of `Pattern::matches_with(..)`
470+
*/
471+
#[cfg(stage0)]
472+
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes)]
473+
pub struct MatchOptions {
474+
475+
/**
476+
* Whether or not patterns should be matched in a case-sensitive manner. This
477+
* currently only considers upper/lower case relationships between ASCII characters,
478+
* but in future this might be extended to work with Unicode.
479+
*/
480+
case_sensitive: bool,
481+
482+
/**
483+
* If this is true then path-component separator characters (e.g. `/` on Posix)
484+
* must be matched by a literal `/`, rather than by `*` or `?` or `[...]`
485+
*/
486+
require_literal_separator: bool,
487+
488+
/**
489+
* If this is true then paths that contain components that start with a `.` will
490+
* not match unless the `.` appears literally in the pattern: `*`, `?` or `[...]`
491+
* will not match. This is useful because such files are conventionally considered
492+
* hidden on Unix systems and it might be desirable to skip them when listing files.
493+
*/
494+
require_literal_leading_dot: bool
495+
}
458496
459497
/**
460498
* Configuration options to modify the behaviour of `Pattern::matches_with(..)`
461499
*/
500+
#[cfg(not(stage0))]
462501
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, IterBytes, Default)]
463502
pub struct MatchOptions {
464503

branches/try2/src/libextra/num/bigint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ impl TotalOrd for BigUint {
115115
if s_len > o_len { return Greater; }
116116

117117
for (&self_i, &other_i) in self.data.rev_iter().zip(other.data.rev_iter()) {
118-
cond!((self_i < other_i) { return Less; }
119-
(self_i > other_i) { return Greater; })
118+
if self_i < other_i { return Less; }
119+
if self_i > other_i { return Greater; }
120120
}
121121
return Equal;
122122
}

branches/try2/src/libextra/rl.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ use std::libc::{c_char, c_int};
1313
use std::{local_data, str, rt};
1414
use std::unstable::finally::Finally;
1515

16+
#[cfg(stage0)]
17+
pub mod rustrt {
18+
use std::libc::{c_char, c_int};
19+
20+
extern {
21+
fn linenoise(prompt: *c_char) -> *c_char;
22+
fn linenoiseHistoryAdd(line: *c_char) -> c_int;
23+
fn linenoiseHistorySetMaxLen(len: c_int) -> c_int;
24+
fn linenoiseHistorySave(file: *c_char) -> c_int;
25+
fn linenoiseHistoryLoad(file: *c_char) -> c_int;
26+
fn linenoiseSetCompletionCallback(callback: *u8);
27+
fn linenoiseAddCompletion(completions: *(), line: *c_char);
28+
29+
fn rust_take_linenoise_lock();
30+
fn rust_drop_linenoise_lock();
31+
}
32+
}
33+
34+
#[cfg(not(stage0))]
1635
pub mod rustrt {
1736
use std::libc::{c_char, c_int};
1837

@@ -90,7 +109,7 @@ pub fn read(prompt: &str) -> Option<~str> {
90109

91110
pub type CompletionCb = @fn(~str, @fn(~str));
92111

93-
local_data_key!(complete_key: CompletionCb)
112+
static complete_key: local_data::Key<CompletionCb> = &local_data::Key;
94113

95114
/// Bind to the main completion callback in the current task.
96115
///

branches/try2/src/librustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ pub mod jit {
190190

191191
// The stage1 compiler won't work, but that doesn't really matter. TLS
192192
// changed only very recently to allow storage of owned values.
193-
local_data_key!(engine_key: ~Engine)
193+
static engine_key: local_data::Key<~Engine> = &local_data::Key;
194194

195195
fn set_engine(engine: ~Engine) {
196196
local_data::set(engine_key, engine)

branches/try2/src/librustc/front/test.rs

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,50 @@ fn mk_std(cx: &TestCtxt) -> ast::view_item {
293293
}
294294
}
295295

296+
#[cfg(stage0)]
297+
fn mk_test_module(cx: &TestCtxt) -> @ast::item {
298+
299+
// Link to extra
300+
let view_items = ~[mk_std(cx)];
301+
302+
// A constant vector of test descriptors.
303+
let tests = mk_tests(cx);
304+
305+
// The synthesized main function which will call the console test runner
306+
// with our list of tests
307+
let ext_cx = cx.ext_cx;
308+
let mainfn = (quote_item!(
309+
pub fn main() {
310+
#[main];
311+
extra::test::test_main_static(::std::os::args(), TESTS);
312+
}
313+
)).unwrap();
314+
315+
let testmod = ast::_mod {
316+
view_items: view_items,
317+
items: ~[mainfn, tests],
318+
};
319+
let item_ = ast::item_mod(testmod);
320+
321+
// This attribute tells resolve to let us call unexported functions
322+
let resolve_unexported_attr =
323+
attr::mk_attr(attr::mk_word_item(@"!resolve_unexported"));
324+
325+
let item = ast::item {
326+
ident: cx.sess.ident_of("__test"),
327+
attrs: ~[resolve_unexported_attr],
328+
id: ast::DUMMY_NODE_ID,
329+
node: item_,
330+
vis: ast::public,
331+
span: dummy_sp(),
332+
};
333+
334+
debug!("Synthetic test module:\n%s\n",
335+
pprust::item_to_str(@item.clone(), cx.sess.intr()));
336+
337+
return @item;
338+
}
339+
#[cfg(not(stage0))]
296340
fn mk_test_module(cx: &TestCtxt) -> @ast::item {
297341

298342
// Link to extra
@@ -363,6 +407,21 @@ fn path_node_global(ids: ~[ast::Ident]) -> ast::Path {
363407
}
364408
}
365409

410+
#[cfg(stage0)]
411+
fn mk_tests(cx: &TestCtxt) -> @ast::item {
412+
413+
let ext_cx = cx.ext_cx;
414+
415+
// The vector of test_descs for this crate
416+
let test_descs = mk_test_descs(cx);
417+
418+
(quote_item!(
419+
pub static TESTS : &'static [self::extra::test::TestDescAndFn] =
420+
$test_descs
421+
;
422+
)).unwrap()
423+
}
424+
#[cfg(not(stage0))]
366425
fn mk_tests(cx: &TestCtxt) -> @ast::item {
367426
// The vector of test_descs for this crate
368427
let test_descs = mk_test_descs(cx);
@@ -402,6 +461,63 @@ fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr {
402461
}
403462
}
404463

464+
#[cfg(stage0)]
465+
fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::Expr {
466+
let span = test.span;
467+
let path = test.path.clone();
468+
469+
let ext_cx = cx.ext_cx;
470+
471+
debug!("encoding %s", ast_util::path_name_i(path));
472+
473+
let name_lit: ast::lit =
474+
nospan(ast::lit_str(ast_util::path_name_i(path).to_managed()));
475+
476+
let name_expr = @ast::Expr {
477+
id: ast::DUMMY_NODE_ID,
478+
node: ast::ExprLit(@name_lit),
479+
span: span
480+
};
481+
482+
let fn_path = path_node_global(path);
483+
484+
let fn_expr = @ast::Expr {
485+
id: ast::DUMMY_NODE_ID,
486+
node: ast::ExprPath(fn_path),
487+
span: span,
488+
};
489+
490+
let t_expr = if test.bench {
491+
quote_expr!( self::extra::test::StaticBenchFn($fn_expr) )
492+
} else {
493+
quote_expr!( self::extra::test::StaticTestFn($fn_expr) )
494+
};
495+
496+
let ignore_expr = if test.ignore {
497+
quote_expr!( true )
498+
} else {
499+
quote_expr!( false )
500+
};
501+
502+
let fail_expr = if test.should_fail {
503+
quote_expr!( true )
504+
} else {
505+
quote_expr!( false )
506+
};
507+
508+
let e = quote_expr!(
509+
self::extra::test::TestDescAndFn {
510+
desc: self::extra::test::TestDesc {
511+
name: self::extra::test::StaticTestName($name_expr),
512+
ignore: $ignore_expr,
513+
should_fail: $fail_expr
514+
},
515+
testfn: $t_expr,
516+
}
517+
);
518+
e
519+
}
520+
#[cfg(not(stage0))]
405521
fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::Expr {
406522
let span = test.span;
407523
let path = test.path.clone();

branches/try2/src/librustc/middle/const_eval.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use syntax::visit;
1919
use syntax::visit::Visitor;
2020
use syntax::ast::*;
2121

22+
use std::float;
2223
use std::hashmap::{HashMap, HashSet};
2324

2425
//
@@ -475,9 +476,9 @@ pub fn lit_to_const(lit: &lit) -> const_val {
475476
lit_int(n, _) => const_int(n),
476477
lit_uint(n, _) => const_uint(n),
477478
lit_int_unsuffixed(n) => const_int(n),
478-
lit_float(n, _) => const_float(from_str::<float>(n).unwrap() as f64),
479+
lit_float(n, _) => const_float(float::from_str(n).unwrap() as f64),
479480
lit_float_unsuffixed(n) =>
480-
const_float(from_str::<float>(n).unwrap() as f64),
481+
const_float(float::from_str(n).unwrap() as f64),
481482
lit_nil => const_int(0i64),
482483
lit_bool(b) => const_bool(b)
483484
}

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

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ use syntax::visit::Visitor;
9292

9393
pub use middle::trans::context::task_llcx;
9494

95-
local_data_key!(task_local_insn_key: @~[&'static str])
95+
static task_local_insn_key: local_data::Key<@~[&'static str]> = &local_data::Key;
9696

9797
pub fn with_insn_ctxt(blk: &fn(&[&'static str])) {
9898
let opt = local_data::get(task_local_insn_key, |k| k.map_move(|k| *k));
@@ -2388,12 +2388,38 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
23882388
let et = ccx.sess.entry_type.unwrap();
23892389
match et {
23902390
session::EntryMain => {
2391-
create_entry_fn(ccx, main_llfn, true);
2391+
let llfn = create_main(ccx, main_llfn);
2392+
create_entry_fn(ccx, llfn, true);
23922393
}
23932394
session::EntryStart => create_entry_fn(ccx, main_llfn, false),
23942395
session::EntryNone => {} // Do nothing.
23952396
}
23962397

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+
23972423
fn create_entry_fn(ccx: @mut CrateContext,
23982424
rust_main: ValueRef,
23992425
use_start_lang_item: bool) {
@@ -2634,7 +2660,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
26342660
foreign::register_foreign_item_fn(ccx, abis, &path, ni)
26352661
}
26362662
ast::foreign_item_static(*) => {
2637-
let ident = foreign::link_name(ccx, ni);
2663+
let ident = token::ident_to_str(&ni.ident);
26382664
let g = do ident.with_c_str |buf| {
26392665
unsafe {
26402666
let ty = type_of(ccx, ty);

branches/try2/src/librustc/middle/trans/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl Drop for CrateContext {
287287
}
288288
}
289289

290-
local_data_key!(task_local_llcx_key: @ContextRef)
290+
static task_local_llcx_key: local_data::Key<@ContextRef> = &local_data::Key;
291291

292292
pub fn task_llcx() -> ContextRef {
293293
let opt = local_data::get(task_local_llcx_key, |k| k.map_move(|k| *k));

0 commit comments

Comments
 (0)