Skip to content

Commit b1a8da6

Browse files
committed
---
yaml --- r: 55669 b: refs/heads/master c: 7d250d3 h: refs/heads/master i: 55667: 331490b v: v3
1 parent e33c0b2 commit b1a8da6

Some content is hidden

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

64 files changed

+1341
-3056
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: f93b3cd5c3783eabd527607adda891d8a84dab4f
2+
refs/heads/master: 7d250d31818be792b56f867b93b5e98817ea6462
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
55
refs/heads/try: 8eb2bab100b42f0ba751552d8eff00eb2134c55a

trunk/src/libcore/core.rc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,9 @@ pub use str::{StrSlice};
9595
pub use container::{Container, Mutable};
9696
pub use vec::{CopyableVector, ImmutableVector};
9797
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
98-
pub use vec::{OwnedVector, OwnedCopyableVector, MutableVector};
98+
pub use vec::{OwnedVector, OwnedCopyableVector};
9999
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
100100
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
101-
pub use iter::{ExtendedMutableIter};
102101

103102
pub use num::{Num, NumCast};
104103
pub use ptr::Ptr;

trunk/src/libcore/hashmap.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use container::{Container, Mutable, Map, Set};
1717
use cmp::{Eq, Equiv};
1818
use hash::Hash;
19+
use to_bytes::IterBytes;
1920
use iter::BaseIter;
2021
use hash::Hash;
2122
use iter;
@@ -71,7 +72,7 @@ fn linear_map_with_capacity_and_keys<K:Eq + Hash,V>(
7172
}
7273
}
7374

74-
priv impl<K:Hash + Eq,V> HashMap<K, V> {
75+
priv impl<K:Hash + IterBytes + Eq,V> HashMap<K, V> {
7576
#[inline(always)]
7677
fn to_bucket(&self, h: uint) -> uint {
7778
// A good hash function with entropy spread over all of the
@@ -110,8 +111,9 @@ priv impl<K:Hash + Eq,V> HashMap<K, V> {
110111
}
111112

112113
#[inline(always)]
113-
fn bucket_for_key_equiv<Q:Hash + Equiv<K>>(&self, k: &Q)
114-
-> SearchResult {
114+
fn bucket_for_key_equiv<Q:Hash + IterBytes + Equiv<K>>(&self,
115+
k: &Q)
116+
-> SearchResult {
115117
let hash = k.hash_keyed(self.k0, self.k1) as uint;
116118
self.bucket_for_key_with_hash_equiv(hash, k)
117119
}
@@ -301,15 +303,15 @@ priv impl<K:Hash + Eq,V> HashMap<K, V> {
301303
}
302304
}
303305
304-
impl<K:Hash + Eq,V> Container for HashMap<K, V> {
306+
impl<K:Hash + IterBytes + Eq,V> Container for HashMap<K, V> {
305307
/// Return the number of elements in the map
306308
fn len(&const self) -> uint { self.size }
307309
308310
/// Return true if the map contains no elements
309311
fn is_empty(&const self) -> bool { self.len() == 0 }
310312
}
311313
312-
impl<K:Hash + Eq,V> Mutable for HashMap<K, V> {
314+
impl<K:Hash + IterBytes + Eq,V> Mutable for HashMap<K, V> {
313315
/// Clear the map, removing all key-value pairs.
314316
fn clear(&mut self) {
315317
for uint::range(0, self.buckets.len()) |idx| {
@@ -319,7 +321,7 @@ impl<K:Hash + Eq,V> Mutable for HashMap<K, V> {
319321
}
320322
}
321323
322-
impl<K:Hash + Eq,V> Map<K, V> for HashMap<K, V> {
324+
impl<K:Hash + IterBytes + Eq,V> Map<K, V> for HashMap<K, V> {
323325
/// Return true if the map contains a value for the specified key
324326
fn contains_key(&self, k: &K) -> bool {
325327
match self.bucket_for_key(k) {
@@ -456,7 +458,7 @@ impl<K:Hash + Eq,V> Map<K, V> for HashMap<K, V> {
456458
}
457459
}
458460
459-
pub impl<K: Hash + Eq, V> HashMap<K, V> {
461+
pub impl<K: Hash + IterBytes + Eq, V> HashMap<K, V> {
460462
/// Create an empty HashMap
461463
fn new() -> HashMap<K, V> {
462464
HashMap::with_capacity(INITIAL_CAPACITY)
@@ -667,7 +669,8 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
667669

668670
/// Return true if the map contains a value for the specified key,
669671
/// using equivalence
670-
fn contains_key_equiv<Q:Hash + Equiv<K>>(&self, key: &Q) -> bool {
672+
fn contains_key_equiv<Q:Hash + IterBytes + Equiv<K>>(&self, key: &Q)
673+
-> bool {
671674
match self.bucket_for_key_equiv(key) {
672675
FoundEntry(_) => {true}
673676
TableFull | FoundHole(_) => {false}
@@ -677,7 +680,8 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
677680
/// Return the value corresponding to the key in the map, using
678681
/// equivalence
679682
#[cfg(stage0)]
680-
fn find_equiv<Q:Hash + Equiv<K>>(&self, k: &Q) -> Option<&'self V> {
683+
fn find_equiv<Q:Hash + IterBytes + Equiv<K>>(&self, k: &Q)
684+
-> Option<&'self V> {
681685
match self.bucket_for_key_equiv(k) {
682686
FoundEntry(idx) => Some(self.value_for_bucket(idx)),
683687
TableFull | FoundHole(_) => None,
@@ -689,15 +693,17 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
689693
#[cfg(stage1)]
690694
#[cfg(stage2)]
691695
#[cfg(stage3)]
692-
fn find_equiv<'a, Q:Hash + Equiv<K>>(&'a self, k: &Q) -> Option<&'a V> {
696+
fn find_equiv<'a, Q:Hash + IterBytes + Equiv<K>>(
697+
&'a self, k: &Q) -> Option<&'a V>
698+
{
693699
match self.bucket_for_key_equiv(k) {
694700
FoundEntry(idx) => Some(self.value_for_bucket(idx)),
695701
TableFull | FoundHole(_) => None,
696702
}
697703
}
698704
}
699705

700-
impl<K:Hash + Eq,V:Eq> Eq for HashMap<K, V> {
706+
impl<K:Hash + IterBytes + Eq,V:Eq> Eq for HashMap<K, V> {
701707
fn eq(&self, other: &HashMap<K, V>) -> bool {
702708
if self.len() != other.len() { return false; }
703709

@@ -718,31 +724,31 @@ pub struct HashSet<T> {
718724
priv map: HashMap<T, ()>
719725
}
720726

721-
impl<T:Hash + Eq> BaseIter<T> for HashSet<T> {
727+
impl<T:Hash + IterBytes + Eq> BaseIter<T> for HashSet<T> {
722728
/// Visit all values in order
723729
fn each(&self, f: &fn(&T) -> bool) { self.map.each_key(f) }
724730
fn size_hint(&self) -> Option<uint> { Some(self.len()) }
725731
}
726732

727-
impl<T:Hash + Eq> Eq for HashSet<T> {
733+
impl<T:Hash + IterBytes + Eq> Eq for HashSet<T> {
728734
fn eq(&self, other: &HashSet<T>) -> bool { self.map == other.map }
729735
fn ne(&self, other: &HashSet<T>) -> bool { self.map != other.map }
730736
}
731737

732-
impl<T:Hash + Eq> Container for HashSet<T> {
738+
impl<T:Hash + IterBytes + Eq> Container for HashSet<T> {
733739
/// Return the number of elements in the set
734740
fn len(&const self) -> uint { self.map.len() }
735741

736742
/// Return true if the set contains no elements
737743
fn is_empty(&const self) -> bool { self.map.is_empty() }
738744
}
739745

740-
impl<T:Hash + Eq> Mutable for HashSet<T> {
746+
impl<T:Hash + IterBytes + Eq> Mutable for HashSet<T> {
741747
/// Clear the set, removing all values.
742748
fn clear(&mut self) { self.map.clear() }
743749
}
744750

745-
impl<T:Hash + Eq> Set<T> for HashSet<T> {
751+
impl<T:Hash + IterBytes + Eq> Set<T> for HashSet<T> {
746752
/// Return true if the set contains a value
747753
fn contains(&self, value: &T) -> bool { self.map.contains_key(value) }
748754

@@ -810,7 +816,7 @@ impl<T:Hash + Eq> Set<T> for HashSet<T> {
810816
}
811817
}
812818

813-
pub impl <T:Hash + Eq> HashSet<T> {
819+
pub impl <T:Hash + IterBytes + Eq> HashSet<T> {
814820
/// Create an empty HashSet
815821
fn new() -> HashSet<T> {
816822
HashSet::with_capacity(INITIAL_CAPACITY)

trunk/src/libcore/iter.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ pub trait ExtendedIter<A> {
4545
fn flat_map_to_vec<B,IB: BaseIter<B>>(&self, op: &fn(&A) -> IB) -> ~[B];
4646
}
4747

48-
pub trait ExtendedMutableIter<A> {
49-
fn eachi_mut(&mut self, blk: &fn(uint, &mut A) -> bool);
50-
}
51-
5248
pub trait EqIter<A:Eq> {
5349
fn contains(&self, x: &A) -> bool;
5450
fn count(&self, x: &A) -> uint;

trunk/src/libcore/libc.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,12 +1097,9 @@ pub mod funcs {
10971097
unsafe fn setbuf(stream: *FILE, buf: *c_char);
10981098
// Omitted: printf and scanf variants.
10991099
unsafe fn fgetc(stream: *FILE) -> c_int;
1100-
#[fast_ffi]
11011100
unsafe fn fgets(buf: *mut c_char, n: c_int,
11021101
stream: *FILE) -> *c_char;
1103-
#[fast_ffi]
11041102
unsafe fn fputc(c: c_int, stream: *FILE) -> c_int;
1105-
#[fast_ffi]
11061103
unsafe fn fputs(s: *c_char, stream: *FILE) -> *c_char;
11071104
// Omitted: getc, getchar (might be macros).
11081105

@@ -1112,10 +1109,8 @@ pub mod funcs {
11121109
// Omitted: putc, putchar (might be macros).
11131110
unsafe fn puts(s: *c_char) -> c_int;
11141111
unsafe fn ungetc(c: c_int, stream: *FILE) -> c_int;
1115-
#[fast_ffi]
11161112
unsafe fn fread(ptr: *mut c_void, size: size_t,
11171113
nobj: size_t, stream: *FILE) -> size_t;
1118-
#[fast_ffi]
11191114
unsafe fn fwrite(ptr: *c_void, size: size_t,
11201115
nobj: size_t, stream: *FILE) -> size_t;
11211116
unsafe fn fseek(stream: *FILE, offset: c_long,
@@ -1149,13 +1144,9 @@ pub mod funcs {
11491144
-> c_long;
11501145
unsafe fn strtoul(s: *c_char, endp: **c_char, base: c_int)
11511146
-> c_ulong;
1152-
#[fast_ffi]
11531147
unsafe fn calloc(nobj: size_t, size: size_t) -> *c_void;
1154-
#[fast_ffi]
11551148
unsafe fn malloc(size: size_t) -> *c_void;
1156-
#[fast_ffi]
11571149
unsafe fn realloc(p: *c_void, size: size_t) -> *c_void;
1158-
#[fast_ffi]
11591150
unsafe fn free(p: *c_void);
11601151
unsafe fn abort() -> !;
11611152
unsafe fn exit(status: c_int) -> !;
@@ -1266,7 +1257,6 @@ pub mod funcs {
12661257
unsafe fn pclose(stream: *FILE) -> c_int;
12671258

12681259
#[link_name = "_fdopen"]
1269-
#[fast_ffi]
12701260
unsafe fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
12711261

12721262
#[link_name = "_fileno"]
@@ -1350,7 +1340,6 @@ pub mod funcs {
13501340
textmode: c_int) -> c_int;
13511341

13521342
#[link_name = "_read"]
1353-
#[fast_ffi]
13541343
unsafe fn read(fd: c_int, buf: *mut c_void, count: c_uint)
13551344
-> c_int;
13561345

@@ -1361,7 +1350,6 @@ pub mod funcs {
13611350
unsafe fn unlink(c: *c_char) -> c_int;
13621351

13631352
#[link_name = "_write"]
1364-
#[fast_ffi]
13651353
unsafe fn write(fd: c_int, buf: *c_void, count: c_uint)
13661354
-> c_int;
13671355
}
@@ -1514,7 +1502,6 @@ pub mod funcs {
15141502
unsafe fn pathconf(path: *c_char, name: c_int) -> c_long;
15151503
unsafe fn pause() -> c_int;
15161504
unsafe fn pipe(fds: *mut c_int) -> c_int;
1517-
#[fast_ffi]
15181505
unsafe fn read(fd: c_int, buf: *mut c_void,
15191506
count: size_t) -> ssize_t;
15201507
unsafe fn rmdir(path: *c_char) -> c_int;
@@ -1527,7 +1514,6 @@ pub mod funcs {
15271514
unsafe fn tcgetpgrp(fd: c_int) -> pid_t;
15281515
unsafe fn ttyname(fd: c_int) -> *c_char;
15291516
unsafe fn unlink(c: *c_char) -> c_int;
1530-
#[fast_ffi]
15311517
unsafe fn write(fd: c_int, buf: *c_void, count: size_t)
15321518
-> ssize_t;
15331519
}

trunk/src/libcore/num/int-template.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,4 +503,4 @@ mod tests {
503503
fn test_range_step_zero_step() {
504504
for range_step(0,10,0) |_i| {}
505505
}
506-
}
506+
}

trunk/src/libcore/num/uint-template.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,4 +474,4 @@ mod tests {
474474
fn test_range_step_zero_step_down() {
475475
for range_step(0,-10,0) |_i| {}
476476
}
477-
}
477+
}

trunk/src/libcore/prelude.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub use container::{Container, Mutable, Map, Set};
3333
pub use hash::Hash;
3434
pub use iter::{BaseIter, ReverseIter, MutableIter, ExtendedIter, EqIter};
3535
pub use iter::{CopyableIter, CopyableOrderedIter, CopyableNonstrictIter};
36-
pub use iter::{Times, ExtendedMutableIter};
36+
pub use iter::Times;
3737
pub use num::{Num, NumCast};
3838
pub use path::GenericPath;
3939
pub use path::Path;
@@ -46,7 +46,7 @@ pub use to_str::ToStr;
4646
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
4747
pub use vec::{CopyableVector, ImmutableVector};
4848
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
49-
pub use vec::{OwnedVector, OwnedCopyableVector, MutableVector};
49+
pub use vec::{OwnedVector, OwnedCopyableVector};
5050
pub use io::{Reader, ReaderUtil, Writer, WriterUtil};
5151

5252
/* Reexported runtime types */

trunk/src/libcore/str.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@ pub fn from_bytes_with_null<'a>(vv: &'a [u8]) -> &'a str {
6767
return unsafe { raw::from_bytes_with_null(vv) };
6868
}
6969

70-
pub fn from_bytes_slice<'a>(vector: &'a [u8]) -> &'a str {
71-
unsafe {
72-
assert!(is_utf8(vector));
73-
let (ptr, len): (*u8, uint) = ::cast::transmute(vector);
74-
let string: &'a str = ::cast::transmute((ptr, len + 1));
75-
string
76-
}
77-
}
78-
7970
/// Copy a slice into a new unique str
8071
pub fn from_slice(s: &str) -> ~str {
8172
unsafe { raw::slice_bytes_owned(s, 0, len(s)) }
@@ -430,15 +421,6 @@ pub fn byte_slice<T>(s: &str, f: &fn(v: &[u8]) -> T) -> T {
430421
}
431422
}
432423

433-
/// Work with the string as a byte slice, not including trailing null, without
434-
/// a callback.
435-
#[inline(always)]
436-
pub fn byte_slice_no_callback<'a>(s: &'a str) -> &'a [u8] {
437-
unsafe {
438-
cast::transmute(s)
439-
}
440-
}
441-
442424
/// Convert a string to a unique vector of characters
443425
pub fn to_chars(s: &str) -> ~[char] {
444426
let mut buf = ~[];

trunk/src/libcore/unstable/lang.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ pub mod rustrt {
3535

3636
#[rust_stack]
3737
unsafe fn rust_upcall_free(ptr: *c_char);
38-
39-
#[fast_ffi]
40-
unsafe fn rust_upcall_malloc_noswitch(td: *c_char,
41-
size: uintptr_t)
42-
-> *c_char;
43-
44-
#[fast_ffi]
45-
unsafe fn rust_upcall_free_noswitch(ptr: *c_char);
4638
}
4739
}
4840

@@ -89,7 +81,7 @@ pub unsafe fn exchange_free(ptr: *c_char) {
8981
#[lang="malloc"]
9082
#[inline(always)]
9183
pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
92-
return rustrt::rust_upcall_malloc_noswitch(td, size);
84+
return rustrt::rust_upcall_malloc(td, size);
9385
}
9486

9587
// NB: Calls to free CANNOT be allowed to fail, as throwing an exception from
@@ -98,7 +90,7 @@ pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
9890
#[lang="free"]
9991
#[inline(always)]
10092
pub unsafe fn local_free(ptr: *c_char) {
101-
rustrt::rust_upcall_free_noswitch(ptr);
93+
rustrt::rust_upcall_free(ptr);
10294
}
10395

10496
#[lang="borrow_as_imm"]

0 commit comments

Comments
 (0)