Skip to content

Commit c21bfa5

Browse files
committed
---
yaml --- r: 140444 b: refs/heads/try2 c: 821979f h: refs/heads/master v: v3
1 parent 637629f commit c21bfa5

Some content is hidden

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

75 files changed

+1959
-624
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: 2e3e0c0892d6fc9d20374d31db994eee4d083366
8+
refs/heads/try2: 821979f9282decc1ba92391249140f49a7102319
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ $(foreach target,$(CFG_TARGET_TRIPLES),\
238238

239239
CORELIB_CRATE := $(S)src/libcore/core.rc
240240
CORELIB_INPUTS := $(wildcard $(addprefix $(S)src/libcore/, \
241-
core.rc *.rs */*.rs */*/*rs))
241+
core.rc *.rs */*.rs */*/*rs */*/*/*rs))
242242

243243
######################################################################
244244
# Standard library variables

branches/try2/mk/docs.mk

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,8 @@ DOCS :=
1616

1717

1818
######################################################################
19-
# Pandoc (reference-manual related)
19+
# Docs, from pandoc, rustdoc (which runs pandoc), and node
2020
######################################################################
21-
ifeq ($(CFG_PANDOC),)
22-
$(info cfg: no pandoc found, omitting doc/rust.pdf)
23-
else
24-
25-
ifeq ($(CFG_NODE),)
26-
$(info cfg: no node found, omitting doc/tutorial.html)
27-
else
2821

2922
doc/rust.css: rust.css
3023
@$(call E, cp: $@)
@@ -34,6 +27,18 @@ doc/manual.css: manual.css
3427
@$(call E, cp: $@)
3528
$(Q)cp -a $< $@ 2> /dev/null
3629

30+
ifeq ($(CFG_PANDOC),)
31+
$(info cfg: no pandoc found, omitting docs)
32+
NO_DOCS = 1
33+
endif
34+
35+
ifeq ($(CFG_NODE),)
36+
$(info cfg: no node found, omitting docs)
37+
NO_DOCS = 1
38+
endif
39+
40+
ifneq ($(NO_DOCS),1)
41+
3742
DOCS += doc/rust.html
3843
doc/rust.html: rust.md doc/version_info.html doc/rust.css doc/manual.css
3944
@$(call E, pandoc: $@)
@@ -47,19 +52,8 @@ doc/rust.html: rust.md doc/version_info.html doc/rust.css doc/manual.css
4752
--css=manual.css \
4853
--include-before-body=doc/version_info.html \
4954
--output=$@
50-
endif
5155

52-
ifeq ($(CFG_PDFLATEX),)
53-
$(info cfg: no pdflatex found, omitting doc/rust.pdf)
54-
else
55-
ifeq ($(CFG_XETEX),)
56-
$(info cfg: no xetex found, disabling doc/rust.pdf)
57-
else
58-
ifeq ($(CFG_LUATEX),)
59-
$(info cfg: lacking luatex, disabling pdflatex)
60-
else
61-
62-
DOCS += doc/rust.pdf
56+
DOCS += doc/rust.tex
6357
doc/rust.tex: rust.md doc/version.md
6458
@$(call E, pandoc: $@)
6559
$(Q)$(CFG_NODE) $(S)doc/prep.js $< | \
@@ -70,17 +64,6 @@ doc/rust.tex: rust.md doc/version.md
7064
--from=markdown --to=latex \
7165
--output=$@
7266

73-
doc/rust.pdf: doc/rust.tex
74-
@$(call E, pdflatex: $@)
75-
$(Q)$(CFG_PDFLATEX) \
76-
-interaction=batchmode \
77-
-output-directory=doc \
78-
$<
79-
80-
endif
81-
endif
82-
endif
83-
8467
DOCS += doc/rustpkg.html
8568
doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css doc/manual.css
8669
@$(call E, pandoc: $@)
@@ -95,13 +78,6 @@ doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css doc/manual.css
9578
--include-before-body=doc/version_info.html \
9679
--output=$@
9780

98-
######################################################################
99-
# Node (tutorial related)
100-
######################################################################
101-
ifeq ($(CFG_NODE),)
102-
$(info cfg: no node found, omitting doc/tutorial.html)
103-
else
104-
10581
DOCS += doc/tutorial.html
10682
doc/tutorial.html: tutorial.md doc/version_info.html doc/rust.css
10783
@$(call E, pandoc: $@)
@@ -153,9 +129,29 @@ doc/tutorial-tasks.html: tutorial-tasks.md doc/version_info.html doc/rust.css
153129
--include-before-body=doc/version_info.html \
154130
--output=$@
155131

132+
ifeq ($(CFG_PDFLATEX),)
133+
$(info cfg: no pdflatex found, omitting doc/rust.pdf)
134+
else
135+
ifeq ($(CFG_XETEX),)
136+
$(info cfg: no xetex found, disabling doc/rust.pdf)
137+
else
138+
ifeq ($(CFG_LUATEX),)
139+
$(info cfg: lacking luatex, disabling pdflatex)
140+
else
141+
142+
DOCS += doc/rust.pdf
143+
doc/rust.pdf: doc/rust.tex
144+
@$(call E, pdflatex: $@)
145+
$(Q)$(CFG_PDFLATEX) \
146+
-interaction=batchmode \
147+
-output-directory=doc \
148+
$<
149+
150+
endif
151+
endif
156152
endif
157-
endif
158153

154+
endif # No pandoc / node
159155

160156
######################################################################
161157
# LLnextgen (grammar analysis from refman)

branches/try2/src/libcore/bool.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ mod tests {
108108

109109
#[test]
110110
fn test_bool_from_str() {
111-
use from_str::FromStr;
112-
113111
do all_values |v| {
114112
assert!(Some(v) == FromStr::from_str(to_str(v)))
115113
}

branches/try2/src/libcore/cast.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
//! Unsafe casting functions
1212
13+
#[cfg(not(stage0))]
1314
use sys;
15+
#[cfg(not(stage0))]
1416
use unstable;
1517

1618
pub mod rusti {

branches/try2/src/libcore/condition.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,27 @@ mod test {
192192

193193
assert!(trapped);
194194
}
195+
196+
// Issue #6009
197+
mod m {
198+
condition! {
199+
sadness: int -> int;
200+
}
201+
202+
mod n {
203+
use super::sadness;
204+
205+
#[test]
206+
fn test_conditions_are_public() {
207+
let mut trapped = false;
208+
do sadness::cond.trap(|_| {
209+
trapped = true;
210+
0
211+
}).in {
212+
sadness::cond.raise(0);
213+
}
214+
assert!(trapped);
215+
}
216+
}
217+
}
195218
}

branches/try2/src/libcore/core.rc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ pub use num::{Bitwise, BitCount, Bounded};
111111
pub use num::{Primitive, Int, Float};
112112

113113
pub use ptr::Ptr;
114+
pub use from_str::FromStr;
114115
pub use to_str::ToStr;
115116
pub use clone::Clone;
116117

@@ -124,6 +125,9 @@ pub mod linkhack {
124125
}
125126
}
126127

128+
// Internal macros
129+
mod macros;
130+
127131
/* The Prelude. */
128132

129133
pub mod prelude;

branches/try2/src/libcore/flate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Simple compression
1616

1717
use libc;
1818
use libc::{c_void, size_t, c_int};
19-
use ptr;
2019
use vec;
2120

2221
#[cfg(test)] use rand;

branches/try2/src/libcore/macros.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[macro_escape];
12+
13+
// Some basic logging
14+
macro_rules! rtdebug_ (
15+
($( $arg:expr),+) => ( {
16+
dumb_println(fmt!( $($arg),+ ));
17+
18+
fn dumb_println(s: &str) {
19+
use io::WriterUtil;
20+
let dbg = ::libc::STDERR_FILENO as ::io::fd_t;
21+
dbg.write_str(s);
22+
dbg.write_str("\n");
23+
}
24+
25+
} )
26+
)
27+
28+
// An alternate version with no output, for turning off logging
29+
macro_rules! rtdebug (
30+
($( $arg:expr),+) => ( $(let _ = $arg)*; )
31+
)
32+
33+
macro_rules! abort(
34+
($( $msg:expr),+) => ( {
35+
rtdebug!($($msg),+);
36+
37+
unsafe { ::libc::abort(); }
38+
} )
39+
)

branches/try2/src/libcore/num/f32.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
//! Operations and constants for `f32`
1212
13-
use from_str;
1413
use num::{Zero, One, strconv};
1514
use prelude::*;
1615

@@ -798,7 +797,7 @@ pub fn from_str_radix(num: &str, rdx: uint) -> Option<f32> {
798797
strconv::ExpNone, false, false)
799798
}
800799
801-
impl from_str::FromStr for f32 {
800+
impl FromStr for f32 {
802801
#[inline(always)]
803802
fn from_str(val: &str) -> Option<f32> { from_str(val) }
804803
}

branches/try2/src/libcore/num/f64.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
//! Operations and constants for `f64`
1212
13-
use from_str;
1413
use libc::c_int;
1514
use num::{Zero, One, strconv};
1615
use prelude::*;
@@ -840,7 +839,7 @@ pub fn from_str_radix(num: &str, rdx: uint) -> Option<f64> {
840839
strconv::ExpNone, false, false)
841840
}
842841
843-
impl from_str::FromStr for f64 {
842+
impl FromStr for f64 {
844843
#[inline(always)]
845844
fn from_str(val: &str) -> Option<f64> { from_str(val) }
846845
}

branches/try2/src/libcore/num/float.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// PORT this must match in width according to architecture
2222

23-
use from_str;
2423
use libc::c_int;
2524
use num::{Zero, One, strconv};
2625
use prelude::*;
@@ -289,7 +288,7 @@ pub fn from_str_radix(num: &str, radix: uint) -> Option<float> {
289288
strconv::ExpNone, false, false)
290289
}
291290
292-
impl from_str::FromStr for float {
291+
impl FromStr for float {
293292
#[inline(always)]
294293
fn from_str(val: &str) -> Option<float> { from_str(val) }
295294
}

branches/try2/src/libcore/num/int-template.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use T = self::inst::T;
1212

13-
use from_str::FromStr;
1413
use num::{ToStrRadix, FromStrRadix};
1514
use num::{Zero, One, strconv};
1615
use prelude::*;

branches/try2/src/libcore/num/uint-template.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use T = self::inst::T;
1212
use T_SIGNED = self::inst::T_SIGNED;
1313

14-
use from_str::FromStr;
1514
use num::{ToStrRadix, FromStrRadix};
1615
use num::{Zero, One, strconv};
1716
use prelude::*;

branches/try2/src/libcore/os.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,28 @@ pub fn list_dir_path(p: &Path) -> ~[~Path] {
772772
list_dir(p).map(|f| ~p.push(*f))
773773
}
774774
775+
/// Removes a directory at the specified path, after removing
776+
/// all its contents. Use carefully!
777+
pub fn remove_dir_recursive(p: &Path) -> bool {
778+
let mut error_happened = false;
779+
for walk_dir(p) |inner| {
780+
if !error_happened {
781+
if path_is_dir(inner) {
782+
if !remove_dir_recursive(inner) {
783+
error_happened = true;
784+
}
785+
}
786+
else {
787+
if !remove_file(inner) {
788+
error_happened = true;
789+
}
790+
}
791+
}
792+
};
793+
// Directory should now be empty
794+
!error_happened && remove_dir(p)
795+
}
796+
775797
/// Removes a directory at the specified path
776798
pub fn remove_dir(p: &Path) -> bool {
777799
return rmdir(p);
@@ -877,6 +899,10 @@ pub fn copy_file(from: &Path, to: &Path) -> bool {
877899
if istream as uint == 0u {
878900
return false;
879901
}
902+
// Preserve permissions
903+
let from_mode = from.get_mode().expect("copy_file: couldn't get permissions \
904+
for source file");
905+
880906
let ostream = do as_c_charp(to.to_str()) |top| {
881907
do as_c_charp("w+b") |modebuf| {
882908
libc::fopen(top, modebuf)
@@ -908,6 +934,15 @@ pub fn copy_file(from: &Path, to: &Path) -> bool {
908934
}
909935
fclose(istream);
910936
fclose(ostream);
937+
938+
// Give the new file the old file's permissions
939+
unsafe {
940+
if do str::as_c_str(to.to_str()) |to_buf| {
941+
libc::chmod(to_buf, from_mode as mode_t)
942+
} != 0 {
943+
return false; // should be a condition...
944+
}
945+
}
911946
return ok;
912947
}
913948
}
@@ -1594,13 +1629,15 @@ mod tests {
15941629
== buf.len() as size_t))
15951630
}
15961631
assert!((libc::fclose(ostream) == (0u as c_int)));
1632+
let in_mode = in.get_mode();
15971633
let rs = os::copy_file(&in, &out);
15981634
if (!os::path_exists(&in)) {
15991635
fail!(fmt!("%s doesn't exist", in.to_str()));
16001636
}
16011637
assert!((rs));
16021638
let rslt = run::run_program(~"diff", ~[in.to_str(), out.to_str()]);
16031639
assert!((rslt == 0));
1640+
assert!(out.get_mode() == in_mode);
16041641
assert!((remove_file(&in)));
16051642
assert!((remove_file(&out)));
16061643
}

0 commit comments

Comments
 (0)