Skip to content

Commit 722cff4

Browse files
committed
---
yaml --- r: 83239 b: refs/heads/try c: a7cf7b7 h: refs/heads/master i: 83237: e2f5730 83235: 7f32ae0 83231: f8a293d v: v3
1 parent fd94959 commit 722cff4

File tree

20 files changed

+104
-299
lines changed

20 files changed

+104
-299
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: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: d84a22addf09f6c7daba070732593c1e3313ed77
5+
refs/heads/try: a7cf7b7b0b3392bc3219e2bea44a0a18283aae50
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/mk/rt.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ 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 \
7574
rt/rust_rng.cpp \
7675
rt/rust_upcall.cpp \
7776
rt/rust_uv.cpp \

branches/try/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/try/src/librustpkg/api.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use target::*;
1616
use version::Version;
1717
use workcache_support::*;
1818

19-
use std::os;
2019
use extra::arc::{Arc,RWArc};
2120
use extra::workcache;
2221
use extra::workcache::{Database, Logger, FreshnessMap};
@@ -41,13 +40,11 @@ pub fn new_default_context(c: workcache::Context, p: Path) -> BuildContext {
4140
}
4241

4342
fn file_is_fresh(path: &str, in_hash: &str) -> bool {
44-
let path = Path(path);
45-
os::path_exists(&path) && in_hash == digest_file_with_date(&path)
43+
in_hash == digest_file_with_date(&Path(path))
4644
}
4745

4846
fn binary_is_fresh(path: &str, in_hash: &str) -> bool {
49-
let path = Path(path);
50-
os::path_exists(&path) && in_hash == digest_only_date(&path)
47+
in_hash == digest_only_date(&Path(path))
5148
}
5249

5350
pub fn new_workcache_context(p: &Path) -> workcache::Context {

branches/try/src/librustpkg/exit_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
pub static COPY_FAILED_CODE: int = 65;
11+
pub static copy_failed_code: int = 65;

branches/try/src/librustpkg/path_util.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ fn target_bin_dir(workspace: &Path) -> Path {
118118
/// directory is, and if the file exists, return it.
119119
pub fn built_executable_in_workspace(pkgid: &PkgId, workspace: &Path) -> Option<Path> {
120120
let mut result = target_build_dir(workspace);
121+
// should use a target-specific subdirectory
121122
result = mk_output_path(Main, Build, pkgid, result);
122123
debug!("built_executable_in_workspace: checking whether %s exists",
123124
result.to_str());

branches/try/src/librustpkg/rustpkg.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use package_source::PkgSrc;
4747
use target::{WhatToBuild, Everything, is_lib, is_main, is_test, is_bench};
4848
// use workcache_support::{discover_outputs, digest_only_date};
4949
use workcache_support::digest_only_date;
50-
use exit_codes::COPY_FAILED_CODE;
50+
use exit_codes::copy_failed_code;
5151

5252
pub mod api;
5353
mod conditions;
@@ -789,10 +789,10 @@ pub fn main_args(args: &[~str]) {
789789
}.run(sub_cmd, rm_args.clone())
790790
};
791791
// FIXME #9262: This is using the same error code for all errors,
792-
// and at least one test case succeeds if rustpkg returns COPY_FAILED_CODE,
792+
// and at least one test case succeeds if rustpkg returns copy_failed_code,
793793
// when actually, it might set the exit code for that even if a different
794794
// unhandled condition got raised.
795-
if result.is_err() { os::set_exit_status(COPY_FAILED_CODE); }
795+
if result.is_err() { os::set_exit_status(copy_failed_code); }
796796

797797
}
798798

branches/try/src/librustpkg/tests.rs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,6 @@ fn executable_exists(repo: &Path, short_name: &str) -> bool {
355355
os::path_exists(&exec) && is_rwx(&exec)
356356
}
357357

358-
fn remove_executable_file(p: &PkgId, workspace: &Path) {
359-
let exec = target_executable_in_workspace(&PkgId::new(p.short_name), workspace);
360-
if os::path_exists(&exec) {
361-
assert!(os::remove_file(&exec));
362-
}
363-
}
364-
365358
fn assert_built_executable_exists(repo: &Path, short_name: &str) {
366359
assert!(built_executable_exists(repo, short_name));
367360
}
@@ -375,14 +368,6 @@ fn built_executable_exists(repo: &Path, short_name: &str) -> bool {
375368
}
376369
}
377370

378-
fn remove_built_executable_file(p: &PkgId, workspace: &Path) {
379-
let exec = built_executable_in_workspace(&PkgId::new(p.short_name), workspace);
380-
match exec {
381-
Some(r) => assert!(os::remove_file(&r)),
382-
None => ()
383-
}
384-
}
385-
386371
fn object_file_exists(repo: &Path, short_name: &str) -> bool {
387372
file_exists(repo, short_name, "o")
388373
}
@@ -1720,44 +1705,6 @@ fn test_dependencies_terminate() {
17201705
command_line_test([~"install", ~"b"], &workspace);
17211706
}
17221707
1723-
#[test]
1724-
fn install_after_build() {
1725-
let b_id = PkgId::new("b");
1726-
let workspace = create_local_package(&b_id);
1727-
command_line_test([~"build", ~"b"], &workspace);
1728-
command_line_test([~"install", ~"b"], &workspace);
1729-
assert_executable_exists(&workspace, b_id.short_name);
1730-
assert_lib_exists(&workspace, &b_id.path, NoVersion);
1731-
}
1732-
1733-
#[test]
1734-
fn reinstall() {
1735-
let b = PkgId::new("b");
1736-
let workspace = create_local_package(&b);
1737-
// 1. Install, then remove executable file, then install again,
1738-
// and make sure executable was re-installed
1739-
command_line_test([~"install", ~"b"], &workspace);
1740-
assert_executable_exists(&workspace, b.short_name);
1741-
assert_lib_exists(&workspace, &b.path, NoVersion);
1742-
remove_executable_file(&b, &workspace);
1743-
command_line_test([~"install", ~"b"], &workspace);
1744-
assert_executable_exists(&workspace, b.short_name);
1745-
// 2. Build, then remove build executable file, then build again,
1746-
// and make sure executable was re-built.
1747-
command_line_test([~"build", ~"b"], &workspace);
1748-
remove_built_executable_file(&b, &workspace);
1749-
command_line_test([~"build", ~"b"], &workspace);
1750-
assert_built_executable_exists(&workspace, b.short_name);
1751-
// 3. Install, then remove both executable and built executable,
1752-
// then install again, make sure both were recreated
1753-
command_line_test([~"install", ~"b"], &workspace);
1754-
remove_executable_file(&b, &workspace);
1755-
remove_built_executable_file(&b, &workspace);
1756-
command_line_test([~"install", ~"b"], &workspace);
1757-
assert_executable_exists(&workspace, b.short_name);
1758-
assert_built_executable_exists(&workspace, b.short_name);
1759-
}
1760-
17611708
/// Returns true if p exists and is executable
17621709
fn is_executable(p: &Path) -> bool {
17631710
use std::libc::consts::os::posix88::{S_IXUSR};

branches/try/src/librustpkg/util.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -283,28 +283,7 @@ pub fn compile_input(context: &BuildContext,
283283

284284
debug!("calling compile_crate_from_input, workspace = %s,
285285
building_library = %?", out_dir.to_str(), sess.building_library);
286-
let result = compile_crate_from_input(in_file,
287-
exec,
288-
context.compile_upto(),
289-
&out_dir,
290-
sess,
291-
crate);
292-
// Discover the output
293-
let discovered_output = if what == Lib {
294-
installed_library_in_workspace(&pkg_id.path, workspace)
295-
}
296-
else {
297-
result
298-
};
299-
debug!("About to discover output %s", discovered_output.to_str());
300-
for p in discovered_output.iter() {
301-
if os::path_exists(p) {
302-
exec.discover_output("binary", p.to_str(), digest_only_date(p));
303-
}
304-
// Nothing to do if it doesn't exist -- that could happen if we had the
305-
// -S or -emit-llvm flags, etc.
306-
}
307-
discovered_output
286+
compile_crate_from_input(in_file, exec, context.compile_upto(), &out_dir, sess, crate)
308287
}
309288

310289
// Should use workcache to avoid recompiling when not necessary

branches/try/src/libstd/char.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ pub fn escape_unicode(c: char, f: &fn(char)) {
281281
// avoid calling str::to_str_radix because we don't really need to allocate
282282
// here.
283283
f('\\');
284-
let pad = cond!(
285-
(c <= '\xff') { f('x'); 2 }
286-
(c <= '\uffff') { f('u'); 4 }
287-
_ { f('U'); 8 }
288-
);
284+
let pad = match () {
285+
_ if c <= '\xff' => { f('x'); 2 }
286+
_ if c <= '\uffff' => { f('u'); 4 }
287+
_ => { f('U'); 8 }
288+
};
289289
for offset in range_step::<i32>(4 * (pad - 1), -1, -4) {
290290
unsafe {
291291
match ((c as i32) >> offset) & 0xf {
@@ -329,13 +329,13 @@ pub fn len_utf8_bytes(c: char) -> uint {
329329
static MAX_FOUR_B: uint = 2097152u;
330330

331331
let code = c as uint;
332-
cond!(
333-
(code < MAX_ONE_B) { 1u }
334-
(code < MAX_TWO_B) { 2u }
335-
(code < MAX_THREE_B) { 3u }
336-
(code < MAX_FOUR_B) { 4u }
337-
_ { fail!("invalid character!") }
338-
)
332+
match () {
333+
_ if code < MAX_ONE_B => 1u,
334+
_ if code < MAX_TWO_B => 2u,
335+
_ if code < MAX_THREE_B => 3u,
336+
_ if code < MAX_FOUR_B => 4u,
337+
_ => fail!("invalid character!"),
338+
}
339339
}
340340

341341
impl ToStr for char {

branches/try/src/libstd/num/f32.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -206,35 +206,35 @@ impl Orderable for f32 {
206206
/// Returns `NaN` if either of the numbers are `NaN`.
207207
#[inline]
208208
fn min(&self, other: &f32) -> f32 {
209-
cond!(
210-
(self.is_NaN()) { *self }
211-
(other.is_NaN()) { *other }
212-
(*self < *other) { *self }
213-
_ { *other }
214-
)
209+
match () {
210+
_ if self.is_NaN() => *self,
211+
_ if other.is_NaN() => *other,
212+
_ if *self < *other => *self,
213+
_ => *other,
214+
}
215215
}
216216

217217
/// Returns `NaN` if either of the numbers are `NaN`.
218218
#[inline]
219219
fn max(&self, other: &f32) -> f32 {
220-
cond!(
221-
(self.is_NaN()) { *self }
222-
(other.is_NaN()) { *other }
223-
(*self > *other) { *self }
224-
_ { *other }
225-
)
220+
match () {
221+
_ if self.is_NaN() => *self,
222+
_ if other.is_NaN() => *other,
223+
_ if *self > *other => *self,
224+
_ => *other,
225+
}
226226
}
227227

228228
/// Returns the number constrained within the range `mn <= self <= mx`.
229229
/// If any of the numbers are `NaN` then `NaN` is returned.
230230
#[inline]
231231
fn clamp(&self, mn: &f32, mx: &f32) -> f32 {
232-
cond!(
233-
(self.is_NaN()) { *self }
234-
(!(*self <= *mx)) { *mx }
235-
(!(*self >= *mn)) { *mn }
236-
_ { *self }
237-
)
232+
match () {
233+
_ if self.is_NaN() => *self,
234+
_ if !(*self <= *mx) => *mx,
235+
_ if !(*self >= *mn) => *mn,
236+
_ => *self,
237+
}
238238
}
239239
}
240240

branches/try/src/libstd/num/f64.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -229,35 +229,35 @@ impl Orderable for f64 {
229229
/// Returns `NaN` if either of the numbers are `NaN`.
230230
#[inline]
231231
fn min(&self, other: &f64) -> f64 {
232-
cond!(
233-
(self.is_NaN()) { *self }
234-
(other.is_NaN()) { *other }
235-
(*self < *other) { *self }
236-
_ { *other }
237-
)
232+
match () {
233+
_ if self.is_NaN() => *self,
234+
_ if other.is_NaN() => *other,
235+
_ if *self < *other => *self,
236+
_ => *other,
237+
}
238238
}
239239

240240
/// Returns `NaN` if either of the numbers are `NaN`.
241241
#[inline]
242242
fn max(&self, other: &f64) -> f64 {
243-
cond!(
244-
(self.is_NaN()) { *self }
245-
(other.is_NaN()) { *other }
246-
(*self > *other) { *self }
247-
_ { *other }
248-
)
243+
match () {
244+
_ if self.is_NaN() => *self,
245+
_ if other.is_NaN() => *other,
246+
_ if *self > *other => *self,
247+
_ => *other,
248+
}
249249
}
250250

251251
/// Returns the number constrained within the range `mn <= self <= mx`.
252252
/// If any of the numbers are `NaN` then `NaN` is returned.
253253
#[inline]
254254
fn clamp(&self, mn: &f64, mx: &f64) -> f64 {
255-
cond!(
256-
(self.is_NaN()) { *self }
257-
(!(*self <= *mx)) { *mx }
258-
(!(*self >= *mn)) { *mn }
259-
_ { *self }
260-
)
255+
match () {
256+
_ if self.is_NaN() => *self,
257+
_ if !(*self <= *mx) => *mx,
258+
_ if !(*self >= *mn) => *mn,
259+
_ => *self,
260+
}
261261
}
262262
}
263263

branches/try/src/libstd/num/uint_macros.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ impl Orderable for $T {
7070
/// Returns the number constrained within the range `mn <= self <= mx`.
7171
#[inline]
7272
fn clamp(&self, mn: &$T, mx: &$T) -> $T {
73-
cond!(
74-
(*self > *mx) { *mx }
75-
(*self < *mn) { *mn }
76-
_ { *self }
77-
)
73+
match () {
74+
_ if (*self > *mx) => *mx,
75+
_ if (*self < *mn) => *mn,
76+
_ => *self,
77+
}
7878
}
7979
}
8080

branches/try/src/libstd/run.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,15 +643,28 @@ fn spawn_process_os(prog: &str, args: &[~str],
643643
use libc::funcs::bsd44::getdtablesize;
644644

645645
mod rustrt {
646-
use libc::c_void;
647-
648646
#[abi = "cdecl"]
649647
extern {
650648
pub fn rust_unset_sigprocmask();
651-
pub fn rust_set_environ(envp: *c_void);
652649
}
653650
}
654651

652+
#[cfg(windows)]
653+
unsafe fn set_environ(_envp: *c_void) {}
654+
#[cfg(target_os = "macos")]
655+
unsafe fn set_environ(envp: *c_void) {
656+
externfn!(fn _NSGetEnviron() -> *mut *c_void);
657+
658+
*_NSGetEnviron() = envp;
659+
}
660+
#[cfg(not(target_os = "macos"), not(windows))]
661+
unsafe fn set_environ(envp: *c_void) {
662+
extern {
663+
static mut environ: *c_void;
664+
}
665+
environ = envp;
666+
}
667+
655668
unsafe {
656669

657670
let pid = fork();
@@ -685,7 +698,7 @@ fn spawn_process_os(prog: &str, args: &[~str],
685698

686699
do with_envp(env) |envp| {
687700
if !envp.is_null() {
688-
rustrt::rust_set_environ(envp);
701+
set_environ(envp);
689702
}
690703
do with_argv(prog, args) |argv| {
691704
execvp(*argv, argv);

0 commit comments

Comments
 (0)