Skip to content

Commit 4b80ed1

Browse files
committed
---
yaml --- r: 59372 b: refs/heads/snap-stage3 c: 4b6864f h: refs/heads/master v: v3
1 parent 393188d commit 4b80ed1

File tree

243 files changed

+14360
-5178
lines changed

Some content is hidden

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

243 files changed

+14360
-5178
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 4f436a8b85b7e8c54ba4402004dc5a27d389450b
4+
refs/heads/snap-stage3: 4b6864f2195250d34cbedf92ffaf23a400c71b9e
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/Makefile.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ endif
110110
ifdef SAVE_TEMPS
111111
CFG_RUSTC_FLAGS += --save-temps
112112
endif
113+
ifdef ASM_COMMENTS
114+
CFG_RUSTC_FLAGS += -z asm-comments
115+
endif
113116
ifdef TIME_PASSES
114117
CFG_RUSTC_FLAGS += -Z time-passes
115118
endif

branches/snap-stage3/src/libcore/cell.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn empty_cell<T>() -> Cell<T> {
4242
pub impl<T> Cell<T> {
4343
/// Yields the value, failing if the cell is empty.
4444
fn take(&self) -> T {
45-
let mut self = unsafe { transmute_mut(self) };
45+
let self = unsafe { transmute_mut(self) };
4646
if self.is_empty() {
4747
fail!(~"attempt to take an empty cell");
4848
}
@@ -54,7 +54,7 @@ pub impl<T> Cell<T> {
5454
5555
/// Returns the value, failing if the cell is full.
5656
fn put_back(&self, value: T) {
57-
let mut self = unsafe { transmute_mut(self) };
57+
let self = unsafe { transmute_mut(self) };
5858
if !self.is_empty() {
5959
fail!(~"attempt to put a value back into a full cell");
6060
}

branches/snap-stage3/src/libcore/char.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use option::{None, Option, Some};
1616
use str;
1717
use u32;
1818
use uint;
19-
use unicode;
19+
use unicode::{derived_property, general_category};
2020

2121
#[cfg(notest)] use cmp::Eq;
2222

@@ -53,18 +53,17 @@ use unicode;
5353
Cn Unassigned a reserved unassigned code point or a noncharacter
5454
*/
5555

56-
pub use is_alphabetic = unicode::derived_property::Alphabetic;
57-
pub use is_XID_start = unicode::derived_property::XID_Start;
58-
pub use is_XID_continue = unicode::derived_property::XID_Continue;
59-
56+
pub fn is_alphabetic(c: char) -> bool { derived_property::Alphabetic(c) }
57+
pub fn is_XID_start(c: char) -> bool { derived_property::XID_Start(c) }
58+
pub fn is_XID_continue(c: char) -> bool { derived_property::XID_Continue(c) }
6059

6160
/**
6261
* Indicates whether a character is in lower case, defined
6362
* in terms of the Unicode General Category 'Ll'
6463
*/
6564
#[inline(always)]
6665
pub fn is_lowercase(c: char) -> bool {
67-
return unicode::general_category::Ll(c);
66+
return general_category::Ll(c);
6867
}
6968

7069
/**
@@ -73,7 +72,7 @@ pub fn is_lowercase(c: char) -> bool {
7372
*/
7473
#[inline(always)]
7574
pub fn is_uppercase(c: char) -> bool {
76-
return unicode::general_category::Lu(c);
75+
return general_category::Lu(c);
7776
}
7877

7978
/**
@@ -84,9 +83,9 @@ pub fn is_uppercase(c: char) -> bool {
8483
#[inline(always)]
8584
pub fn is_whitespace(c: char) -> bool {
8685
return ('\x09' <= c && c <= '\x0d')
87-
|| unicode::general_category::Zs(c)
88-
|| unicode::general_category::Zl(c)
89-
|| unicode::general_category::Zp(c);
86+
|| general_category::Zs(c)
87+
|| general_category::Zl(c)
88+
|| general_category::Zp(c);
9089
}
9190

9291
/**
@@ -96,18 +95,18 @@ pub fn is_whitespace(c: char) -> bool {
9695
*/
9796
#[inline(always)]
9897
pub fn is_alphanumeric(c: char) -> bool {
99-
return unicode::derived_property::Alphabetic(c) ||
100-
unicode::general_category::Nd(c) ||
101-
unicode::general_category::Nl(c) ||
102-
unicode::general_category::No(c);
98+
return derived_property::Alphabetic(c) ||
99+
general_category::Nd(c) ||
100+
general_category::Nl(c) ||
101+
general_category::No(c);
103102
}
104103

105104
/// Indicates whether the character is numeric (Nd, Nl, or No)
106105
#[inline(always)]
107106
pub fn is_digit(c: char) -> bool {
108-
return unicode::general_category::Nd(c) ||
109-
unicode::general_category::Nl(c) ||
110-
unicode::general_category::No(c);
107+
return general_category::Nd(c) ||
108+
general_category::Nl(c) ||
109+
general_category::No(c);
111110
}
112111

113112
/**

branches/snap-stage3/src/libcore/cleanup.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use ptr::mut_null;
1515
use repr::BoxRepr;
1616
use sys::TypeDesc;
1717
use cast::transmute;
18+
#[cfg(notest)] use unstable::lang::clear_task_borrow_list;
1819

1920
#[cfg(notest)] use ptr::to_unsafe_ptr;
2021

@@ -179,6 +180,10 @@ pub unsafe fn annihilate() {
179180
n_bytes_freed: 0
180181
};
181182

183+
// Quick hack: we need to free this list upon task exit, and this
184+
// is a convenient place to do it.
185+
clear_task_borrow_list();
186+
182187
// Pass 1: Make all boxes immortal.
183188
//
184189
// In this pass, nothing gets freed, so it does not matter whether

branches/snap-stage3/src/libcore/comm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ impl<T: Owned> Selectable for Port<T> {
205205
fn header(&self) -> *PacketHeader {
206206
unsafe {
207207
match self.endp {
208-
Some(ref endp) => endp.header(),
209-
None => fail!(~"peeking empty stream")
208+
Some(ref endp) => endp.header(),
209+
None => fail!(~"peeking empty stream")
210210
}
211211
}
212212
}

branches/snap-stage3/src/libcore/core.rc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,12 @@ pub mod unstable;
244244

245245
/* For internal use, not exported */
246246

247-
pub mod unicode;
247+
mod unicode;
248248
#[path = "num/cmath.rs"]
249-
pub mod cmath;
250-
pub mod stackwalk;
249+
mod cmath;
250+
mod stackwalk;
251251
#[path = "rt/mod.rs"]
252-
pub mod rt;
252+
mod rt;
253253

254254
// A curious inner-module that's not exported that contains the binding
255255
// 'core' so that macro-expanded references to core::error and such

branches/snap-stage3/src/libcore/flate.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ pub mod rustrt {
2828
pub extern {
2929
unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
3030
src_buf_len: size_t,
31-
pout_len: *size_t,
31+
pout_len: *mut size_t,
3232
flags: c_int)
3333
-> *c_void;
3434

3535
unsafe fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
3636
src_buf_len: size_t,
37-
pout_len: *size_t,
37+
pout_len: *mut size_t,
3838
flags: c_int)
3939
-> *c_void;
4040
}
@@ -52,11 +52,11 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
5252
let res =
5353
rustrt::tdefl_compress_mem_to_heap(b as *c_void,
5454
len as size_t,
55-
&outsz,
55+
&mut outsz,
5656
lz_norm);
5757
assert!(res as int != 0);
5858
let out = vec::raw::from_buf_raw(res as *u8,
59-
outsz as uint);
59+
outsz as uint);
6060
libc::free(res);
6161
out
6262
}
@@ -66,11 +66,11 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
6666
pub fn inflate_bytes(bytes: &const [u8]) -> ~[u8] {
6767
do vec::as_const_buf(bytes) |b, len| {
6868
unsafe {
69-
let outsz : size_t = 0;
69+
let mut outsz : size_t = 0;
7070
let res =
7171
rustrt::tinfl_decompress_mem_to_heap(b as *c_void,
7272
len as size_t,
73-
&outsz,
73+
&mut outsz,
7474
0);
7575
assert!(res as int != 0);
7676
let out = vec::raw::from_buf_raw(res as *u8,

branches/snap-stage3/src/libcore/gc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use libc::{size_t, uintptr_t};
4444
use option::{None, Option, Some};
4545
use ptr;
4646
use hashmap::HashSet;
47-
use stackwalk;
47+
use stackwalk::walk_stack;
4848
use sys;
4949

5050
pub use stackwalk::Word;
@@ -230,7 +230,7 @@ unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) {
230230
// frame is marked by a sentinel, which is a box pointer stored on
231231
// the stack.
232232
let mut reached_sentinel = ptr::is_null(sentinel);
233-
for stackwalk::walk_stack |frame| {
233+
for walk_stack |frame| {
234234
let pc = last_ret;
235235
let Segment {segment: next_segment, boundary: boundary} =
236236
find_segment_for_frame(frame.fp, segment);

branches/snap-stage3/src/libcore/hashmap.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use rand;
2525
use uint;
2626
use vec;
2727
use util::unreachable;
28+
use kinds::Copy;
2829

2930
static INITIAL_CAPACITY: uint = 32u; // 2^5
3031

@@ -529,6 +530,18 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
529530
}
530531
}
531532

533+
pub impl<K: Hash + Eq, V: Copy> HashMap<K, V> {
534+
/// Like `find`, but returns a copy of the value.
535+
fn find_copy(&self, k: &K) -> Option<V> {
536+
self.find(k).map_consume(|v| copy *v)
537+
}
538+
539+
/// Like `get`, but returns a copy of the value.
540+
fn get_copy(&self, k: &K) -> V {
541+
copy *self.get(k)
542+
}
543+
}
544+
532545
impl<K:Hash + Eq,V:Eq> Eq for HashMap<K, V> {
533546
fn eq(&self, other: &HashMap<K, V>) -> bool {
534547
if self.len() != other.len() { return false; }

branches/snap-stage3/src/libcore/io.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ pub enum WriterType { Screen, File }
10221022
pub trait Writer {
10231023
10241024
/// Write all of the given bytes.
1025-
fn write(&self, v: &const [u8]);
1025+
fn write(&self, v: &[u8]);
10261026
10271027
/// Move the current position within the stream. The second parameter
10281028
/// determines the position that the first parameter is relative to.
@@ -1039,23 +1039,23 @@ pub trait Writer {
10391039
}
10401040
10411041
impl Writer for @Writer {
1042-
fn write(&self, v: &const [u8]) { self.write(v) }
1042+
fn write(&self, v: &[u8]) { self.write(v) }
10431043
fn seek(&self, a: int, b: SeekStyle) { self.seek(a, b) }
10441044
fn tell(&self) -> uint { self.tell() }
10451045
fn flush(&self) -> int { self.flush() }
10461046
fn get_type(&self) -> WriterType { self.get_type() }
10471047
}
10481048
10491049
impl<W:Writer,C> Writer for Wrapper<W, C> {
1050-
fn write(&self, bs: &const [u8]) { self.base.write(bs); }
1050+
fn write(&self, bs: &[u8]) { self.base.write(bs); }
10511051
fn seek(&self, off: int, style: SeekStyle) { self.base.seek(off, style); }
10521052
fn tell(&self) -> uint { self.base.tell() }
10531053
fn flush(&self) -> int { self.base.flush() }
10541054
fn get_type(&self) -> WriterType { File }
10551055
}
10561056
10571057
impl Writer for *libc::FILE {
1058-
fn write(&self, v: &const [u8]) {
1058+
fn write(&self, v: &[u8]) {
10591059
unsafe {
10601060
do vec::as_const_buf(v) |vbuf, len| {
10611061
let nout = libc::fwrite(vbuf as *c_void,
@@ -1105,7 +1105,7 @@ pub fn FILE_writer(f: *libc::FILE, cleanup: bool) -> @Writer {
11051105
}
11061106

11071107
impl Writer for fd_t {
1108-
fn write(&self, v: &const [u8]) {
1108+
fn write(&self, v: &[u8]) {
11091109
unsafe {
11101110
let mut count = 0u;
11111111
do vec::as_const_buf(v) |vbuf, len| {
@@ -1262,7 +1262,7 @@ pub fn u64_to_be_bytes<T>(n: u64, size: uint,
12621262
}
12631263
}
12641264

1265-
pub fn u64_from_be_bytes(data: &const [u8],
1265+
pub fn u64_from_be_bytes(data: &[u8],
12661266
start: uint,
12671267
size: uint)
12681268
-> u64 {
@@ -1497,7 +1497,7 @@ pub struct BytesWriter {
14971497
}
14981498
14991499
impl Writer for BytesWriter {
1500-
fn write(&self, v: &const [u8]) {
1500+
fn write(&self, v: &[u8]) {
15011501
let v_len = v.len();
15021502
let bytes_len = vec::uniq_len(&const self.bytes);
15031503

branches/snap-stage3/src/libcore/libc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ pub mod types {
268268
pub type ssize_t = i32;
269269
}
270270
pub mod posix01 {
271-
use libc::types::os::arch::c95::{c_int, c_short, c_long,
272-
time_t};
271+
use libc::types::os::arch::c95::{c_short, c_long, time_t};
273272
use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t};
274273
use libc::types::os::arch::posix88::{mode_t, off_t};
275274
use libc::types::os::arch::posix88::{uid_t};

branches/snap-stage3/src/libcore/os.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,13 @@ pub fn fsync_fd(fd: c_int, _l: io::fsync::Level) -> c_int {
352352
}
353353
}
354354

355-
pub struct Pipe { mut in: c_int, mut out: c_int }
355+
pub struct Pipe { in: c_int, out: c_int }
356356

357357
#[cfg(unix)]
358358
pub fn pipe() -> Pipe {
359359
unsafe {
360360
let mut fds = Pipe {in: 0 as c_int,
361-
out: 0 as c_int };
361+
out: 0 as c_int };
362362
assert!((libc::pipe(&mut fds.in) == (0 as c_int)));
363363
return Pipe {in: fds.in, out: fds.out};
364364
}
@@ -1025,10 +1025,10 @@ pub fn last_os_error() -> ~str {
10251025
#[cfg(target_os = "macos")]
10261026
#[cfg(target_os = "android")]
10271027
#[cfg(target_os = "freebsd")]
1028-
fn strerror_r(errnum: c_int, buf: *c_char, buflen: size_t) -> c_int {
1028+
fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int {
10291029
#[nolink]
10301030
extern {
1031-
unsafe fn strerror_r(errnum: c_int, buf: *c_char,
1031+
unsafe fn strerror_r(errnum: c_int, buf: *mut c_char,
10321032
buflen: size_t) -> c_int;
10331033
}
10341034
unsafe {
@@ -1040,10 +1040,10 @@ pub fn last_os_error() -> ~str {
10401040
// and requires macros to instead use the POSIX compliant variant.
10411041
// So we just use __xpg_strerror_r which is always POSIX compliant
10421042
#[cfg(target_os = "linux")]
1043-
fn strerror_r(errnum: c_int, buf: *c_char, buflen: size_t) -> c_int {
1043+
fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int {
10441044
#[nolink]
10451045
extern {
1046-
unsafe fn __xpg_strerror_r(errnum: c_int, buf: *c_char,
1046+
unsafe fn __xpg_strerror_r(errnum: c_int, buf: *mut c_char,
10471047
buflen: size_t) -> c_int;
10481048
}
10491049
unsafe {
@@ -1053,7 +1053,7 @@ pub fn last_os_error() -> ~str {
10531053
10541054
let mut buf = [0 as c_char, ..TMPBUF_SZ];
10551055
unsafe {
1056-
let err = strerror_r(errno() as c_int, &buf[0],
1056+
let err = strerror_r(errno() as c_int, &mut buf[0],
10571057
TMPBUF_SZ as size_t);
10581058
if err < 0 {
10591059
fail!(~"strerror_r failure");

0 commit comments

Comments
 (0)