Skip to content

Commit f9ffb88

Browse files
committed
---
yaml --- r: 139118 b: refs/heads/try2 c: fe74a1c h: refs/heads/master v: v3
1 parent f832d42 commit f9ffb88

Some content is hidden

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

86 files changed

+2107
-2421
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: 51da7d4bc7a100f5343bc727fb2fb87b05e35c84
8+
refs/heads/try2: fe74a1c9a2ebd40028a4f389dc10c82f37fb0fe2
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libcore/libc.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,8 +1221,9 @@ pub mod funcs {
12211221
#[nolink]
12221222
#[abi = "cdecl"]
12231223
pub mod fcntl {
1224-
use libc::types::os::arch::c95::{c_int, c_char};
12251224
pub extern {
1225+
use libc::types::os::arch::c95::{c_int, c_char};
1226+
12261227
#[link_name = "_open"]
12271228
unsafe fn open(path: *c_char, oflag: c_int, mode: c_int)
12281229
-> c_int;
@@ -1561,11 +1562,11 @@ pub mod funcs {
15611562
#[cfg(target_os = "macos")]
15621563
#[cfg(target_os = "freebsd")]
15631564
pub mod bsd44 {
1564-
use libc::types::common::c95::{c_void};
1565-
use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1566-
15671565
#[abi = "cdecl"]
15681566
pub extern {
1567+
use libc::types::common::c95::{c_void};
1568+
use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1569+
15691570
unsafe fn sysctl(name: *c_int, namelen: c_uint,
15701571
oldp: *mut c_void, oldlenp: *mut size_t,
15711572
newp: *c_void, newlen: size_t) -> c_int;

branches/try2/src/libcore/rt/env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ pub fn get() -> &Environment {
4444

4545
extern {
4646
fn rust_get_rt_env() -> &Environment;
47-
}
47+
}

branches/try2/src/libcore/rt/sched.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ enum CleanupJob {
7070

7171
pub impl Scheduler {
7272

73-
static pub fn new(event_loop: ~EventLoopObject) -> Scheduler {
73+
static fn new(event_loop: ~EventLoopObject) -> Scheduler {
7474
Scheduler {
7575
event_loop: event_loop,
7676
task_queue: WorkQueue::new(),
@@ -296,7 +296,7 @@ pub struct Task {
296296
}
297297

298298
impl Task {
299-
static pub fn new(stack_pool: &mut StackPool, start: ~fn()) -> Task {
299+
static fn new(stack_pool: &mut StackPool, start: ~fn()) -> Task {
300300
// XXX: Putting main into a ~ so it's a thin pointer and can
301301
// be passed to the spawn function. Another unfortunate
302302
// allocation

branches/try2/src/libcore/rt/stack.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ pub impl StackSegment {
3737
pub struct StackPool(());
3838

3939
impl StackPool {
40-
static pub fn new() -> StackPool { StackPool(()) }
40+
41+
static fn new() -> StackPool { StackPool(()) }
4142

4243
fn take_segment(&self, min_size: uint) -> StackSegment {
4344
StackSegment::new(min_size)

branches/try2/src/libcore/rt/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct Thread {
2020
}
2121

2222
impl Thread {
23-
static pub fn start(main: ~fn()) -> Thread {
23+
static fn start(main: ~fn()) -> Thread {
2424
fn substart(main: &fn()) -> *raw_thread {
2525
unsafe { rust_raw_thread_start(&main) }
2626
}

branches/try2/src/libcore/task/rt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub type rust_task = libc::c_void;
3030
#[allow(non_camel_case_types)] // runtime type
3131
pub type rust_closure = libc::c_void;
3232

33-
pub extern {
33+
extern {
3434
#[rust_stack]
3535
fn rust_task_yield(task: *rust_task) -> bool;
3636

branches/try2/src/libcore/vec.rs

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ pub pure fn foldl<T, U>(z: T, v: &[U], p: &fn(t: T, u: &U) -> T) -> T {
10051005
*/
10061006
pub pure fn foldr<T, U: Copy>(v: &[T], z: U, p: &fn(t: &T, u: U) -> U) -> U {
10071007
let mut accum = z;
1008-
for rev_each(v) |elt| {
1008+
for v.each_reverse |elt| {
10091009
accum = p(elt, accum);
10101010
}
10111011
accum
@@ -1411,8 +1411,8 @@ pub pure fn eachi<T>(v: &'r [T], f: &fn(uint, v: &'r T) -> bool) {
14111411
* Return true to continue, false to break.
14121412
*/
14131413
#[inline(always)]
1414-
pub pure fn rev_each<T>(v: &'r [T], blk: &fn(v: &'r T) -> bool) {
1415-
rev_eachi(v, |_i, v| blk(v))
1414+
pub pure fn each_reverse<T>(v: &'r [T], blk: &fn(v: &'r T) -> bool) {
1415+
eachi_reverse(v, |_i, v| blk(v))
14161416
}
14171417

14181418
/**
@@ -1421,7 +1421,7 @@ pub pure fn rev_each<T>(v: &'r [T], blk: &fn(v: &'r T) -> bool) {
14211421
* Return true to continue, false to break.
14221422
*/
14231423
#[inline(always)]
1424-
pub pure fn rev_eachi<T>(v: &'r [T], blk: &fn(i: uint, v: &'r T) -> bool) {
1424+
pub pure fn eachi_reverse<T>(v: &'r [T], blk: &fn(i: uint, v: &'r T) -> bool) {
14251425
let mut i = v.len();
14261426
while i > 0 {
14271427
i -= 1;
@@ -1736,6 +1736,8 @@ pub trait ImmutableVector<T> {
17361736
pure fn initn(&self, n: uint) -> &'self [T];
17371737
pure fn last(&self) -> &'self T;
17381738
pure fn last_opt(&self) -> Option<&'self T>;
1739+
pure fn each_reverse(&self, blk: &fn(&T) -> bool);
1740+
pure fn eachi_reverse(&self, blk: &fn(uint, &T) -> bool);
17391741
pure fn foldr<U: Copy>(&self, z: U, p: &fn(t: &T, u: U) -> U) -> U;
17401742
pure fn map<U>(&self, f: &fn(t: &T) -> U) -> ~[U];
17411743
pure fn mapi<U>(&self, f: &fn(uint, t: &T) -> U) -> ~[U];
@@ -1785,6 +1787,18 @@ impl<T> ImmutableVector<T> for &'self [T] {
17851787
#[inline]
17861788
pure fn last_opt(&self) -> Option<&'self T> { last_opt(*self) }
17871789

1790+
/// Iterates over a vector's elements in reverse.
1791+
#[inline]
1792+
pure fn each_reverse(&self, blk: &fn(&T) -> bool) {
1793+
each_reverse(*self, blk)
1794+
}
1795+
1796+
/// Iterates over a vector's elements and indices in reverse.
1797+
#[inline]
1798+
pure fn eachi_reverse(&self, blk: &fn(uint, &T) -> bool) {
1799+
eachi_reverse(*self, blk)
1800+
}
1801+
17881802
/// Reduce a vector from right to left
17891803
#[inline]
17901804
pure fn foldr<U:Copy>(&self, z: U, p: &fn(t: &T, u: U) -> U) -> U {
@@ -3131,33 +3145,42 @@ mod tests {
31313145
}
31323146

31333147
#[test]
3134-
fn test_reach_empty() {
3135-
for rev_each::<int>(~[]) |_v| {
3148+
fn test_each_reverse_empty() {
3149+
let v: ~[int] = ~[];
3150+
for v.each_reverse |_v| {
31363151
fail!(); // should never execute
31373152
}
31383153
}
31393154

31403155
#[test]
3141-
fn test_reach_nonempty() {
3156+
fn test_each_reverse_nonempty() {
31423157
let mut i = 0;
3143-
for rev_each(~[1, 2, 3]) |v| {
3158+
for each_reverse(~[1, 2, 3]) |v| {
31443159
if i == 0 { fail_unless!(*v == 3); }
31453160
i += *v
31463161
}
31473162
fail_unless!(i == 6);
31483163
}
31493164

31503165
#[test]
3151-
fn test_reachi() {
3166+
fn test_eachi_reverse() {
31523167
let mut i = 0;
3153-
for rev_eachi(~[0, 1, 2]) |j, v| {
3168+
for eachi_reverse(~[0, 1, 2]) |j, v| {
31543169
if i == 0 { fail_unless!(*v == 2); }
31553170
fail_unless!(j == *v as uint);
31563171
i += *v;
31573172
}
31583173
fail_unless!(i == 3);
31593174
}
31603175

3176+
#[test]
3177+
fn test_eachi_reverse_empty() {
3178+
let v: ~[int] = ~[];
3179+
for v.eachi_reverse |_i, _v| {
3180+
fail!(); // should never execute
3181+
}
3182+
}
3183+
31613184
#[test]
31623185
fn test_each_permutation() {
31633186
let mut results: ~[~[int]];

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

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,15 @@ pub mod write {
167167
use back::link::{output_type_assembly, output_type_bitcode};
168168
use back::link::{output_type_exe, output_type_llvm_assembly};
169169
use back::link::{output_type_object};
170-
use back::link::output_type;
171170
use driver::session::Session;
172171
use driver::session;
173172
use lib::llvm::llvm;
174173
use lib::llvm::{False, True, ModuleRef, mk_pass_manager, mk_target_data};
175174
use lib;
176175

177-
use core::prelude::*;
178176
use core::libc::{c_char, c_int, c_uint};
179177
use core::path::Path;
180178
use core::str;
181-
use core::run;
182179

183180
pub fn is_object_or_assembly_or_exe(ot: output_type) -> bool {
184181
if ot == output_type_assembly || ot == output_type_object ||
@@ -188,13 +185,13 @@ pub mod write {
188185
return false;
189186
}
190187

191-
pub fn run_passes(sess: Session, llmod: ModuleRef,
192-
output_type: output_type, output: &Path) {
188+
pub fn run_passes(sess: Session, llmod: ModuleRef, output: &Path) {
193189
unsafe {
194190
let opts = sess.opts;
195191
if sess.time_llvm_passes() { llvm::LLVMRustEnableTimePasses(); }
196192
let mut pm = mk_pass_manager();
197-
let td = mk_target_data(sess.targ_cfg.target_strs.data_layout);
193+
let td = mk_target_data(
194+
/*bad*/copy sess.targ_cfg.target_strs.data_layout);
198195
llvm::LLVMAddTargetData(td.lltd, pm.llpm);
199196
// FIXME (#2812): run the linter here also, once there are llvm-c
200197
// bindings for it.
@@ -204,7 +201,7 @@ pub mod write {
204201

205202

206203
if opts.save_temps {
207-
match output_type {
204+
match opts.output_type {
208205
output_type_bitcode => {
209206
if opts.optimize != session::No {
210207
let filename = output.with_filetype("no-opt.bc");
@@ -265,7 +262,7 @@ pub mod write {
265262
llvm::LLVMPassManagerBuilderDispose(MPMB);
266263
}
267264
if !sess.no_verify() { llvm::LLVMAddVerifierPass(pm.llpm); }
268-
if is_object_or_assembly_or_exe(output_type) || opts.jit {
265+
if is_object_or_assembly_or_exe(opts.output_type) || opts.jit {
269266
let LLVMOptNone = 0 as c_int; // -O0
270267
let LLVMOptLess = 1 as c_int; // -O1
271268
let LLVMOptDefault = 2 as c_int; // -O2, -Os
@@ -293,8 +290,8 @@ pub mod write {
293290
}
294291

295292
let mut FileType;
296-
if output_type == output_type_object ||
297-
output_type == output_type_exe {
293+
if opts.output_type == output_type_object ||
294+
opts.output_type == output_type_exe {
298295
FileType = lib::llvm::ObjectFile;
299296
} else { FileType = lib::llvm::AssemblyFile; }
300297
// Write optimized bitcode if --save-temps was on.
@@ -310,7 +307,7 @@ pub mod write {
310307
pm = mk_pass_manager();
311308
// Save the assembly file if -S is used
312309

313-
if output_type == output_type_assembly {
310+
if opts.output_type == output_type_assembly {
314311
let _: () = str::as_c_str(
315312
sess.targ_cfg.target_strs.target_triple,
316313
|buf_t| {
@@ -331,8 +328,8 @@ pub mod write {
331328

332329
// Save the object file for -c or --save-temps alone
333330
// This .o is needed when an exe is built
334-
if output_type == output_type_object ||
335-
output_type == output_type_exe {
331+
if opts.output_type == output_type_object ||
332+
opts.output_type == output_type_exe {
336333
let _: () = str::as_c_str(
337334
sess.targ_cfg.target_strs.target_triple,
338335
|buf_t| {
@@ -378,7 +375,7 @@ pub mod write {
378375
return;
379376
}
380377

381-
if output_type == output_type_llvm_assembly {
378+
if opts.output_type == output_type_llvm_assembly {
382379
// Given options "-S --emit-llvm": output LLVM assembly
383380
str::as_c_str(output.to_str(), |buf_o| {
384381
llvm::LLVMRustAddPrintModulePass(pm.llpm, llmod, buf_o)});
@@ -394,34 +391,6 @@ pub mod write {
394391
if sess.time_llvm_passes() { llvm::LLVMRustPrintPassTimings(); }
395392
}
396393
}
397-
398-
pub fn run_ndk(sess: Session, assembly: &Path, object: &Path) {
399-
let cc_prog: ~str = match &sess.opts.android_cross_path {
400-
&Some(copy path) => {
401-
fmt!("%s/bin/arm-linux-androideabi-gcc", path)
402-
}
403-
&None => {
404-
sess.fatal(~"need Android NDK path for building \
405-
(--android-cross-path)")
406-
}
407-
};
408-
let mut cc_args = ~[];
409-
cc_args.push(~"-c");
410-
cc_args.push(~"-o");
411-
cc_args.push(object.to_str());
412-
cc_args.push(assembly.to_str());
413-
414-
let prog = run::program_output(cc_prog, cc_args);
415-
416-
if prog.status != 0 {
417-
sess.err(fmt!("building with `%s` failed with code %d",
418-
cc_prog, prog.status));
419-
sess.note(fmt!("%s arguments: %s",
420-
cc_prog, str::connect(cc_args, ~" ")));
421-
sess.note(prog.err + prog.out);
422-
sess.abort_if_errors();
423-
}
424-
}
425394
}
426395

427396

@@ -865,9 +834,8 @@ pub fn link_binary(sess: Session,
865834
// to be found at compile time so it is still entirely up to outside
866835
// forces to make sure that library can be found at runtime.
867836

868-
for sess.opts.addl_lib_search_paths.each |path| {
869-
cc_args.push(~"-L" + path.to_str());
870-
}
837+
let addl_paths = /*bad*/copy sess.opts.addl_lib_search_paths;
838+
for addl_paths.each |path| { cc_args.push(~"-L" + path.to_str()); }
871839

872840
// The names of the extern libraries
873841
let used_libs = cstore::get_used_libraries(cstore);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ pub fn get_rpath_flags(sess: session::Session, out_filename: &Path)
4545
// where rustrt is and we know every rust program needs it
4646
let libs = vec::append_one(libs, get_sysroot_absolute_rt_lib(sess));
4747

48-
let rpaths = get_rpaths(os, &sysroot, output, libs,
49-
sess.opts.target_triple);
48+
let target_triple = /*bad*/copy sess.opts.target_triple;
49+
let rpaths = get_rpaths(os, &sysroot, output, libs, target_triple);
5050
rpaths_to_flags(rpaths)
5151
}
5252

@@ -140,8 +140,8 @@ pub fn get_relative_to(abs1: &Path, abs2: &Path) -> Path {
140140
let abs2 = abs2.normalize();
141141
debug!("finding relative path from %s to %s",
142142
abs1.to_str(), abs2.to_str());
143-
let split1: &[~str] = abs1.components;
144-
let split2: &[~str] = abs2.components;
143+
let split1 = /*bad*/copy abs1.components;
144+
let split2 = /*bad*/copy abs2.components;
145145
let len1 = vec::len(split1);
146146
let len2 = vec::len(split2);
147147
fail_unless!(len1 > 0);

0 commit comments

Comments
 (0)