Skip to content

Commit 86e0462

Browse files
committed
---
yaml --- r: 150728 b: refs/heads/try2 c: 11c9871 h: refs/heads/master v: v3
1 parent 214703c commit 86e0462

Some content is hidden

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

70 files changed

+983
-1089
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: 9af93ad54ddf2ac7a04d5ea0c07ad362537e8126
8+
refs/heads/try2: 11c9871bcc34f5f0ed3ba92a1cc5629b9ffe422e
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/compiletest/runtest.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use std::io::timer;
3131
use std::io;
3232
use std::os;
3333
use std::str;
34-
use std::strbuf::StrBuf;
3534
use std::task;
3635
use std::slice;
3736
use test::MetricMap;
@@ -329,10 +328,10 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
329328
}
330329

331330
let args = split_maybe_args(&config.target_rustcflags);
332-
let mut tool_path = StrBuf::new();
331+
let mut tool_path:~str = ~"";
333332
for arg in args.iter() {
334333
if arg.contains("android-cross-path=") {
335-
tool_path = StrBuf::from_str(arg.replace("android-cross-path=", ""));
334+
tool_path = arg.replace("android-cross-path=","");
336335
break;
337336
}
338337
}
@@ -349,7 +348,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
349348
let gdb_path = tool_path.append("/bin/arm-linux-androideabi-gdb");
350349
let procsrv::Result{ out, err, status }=
351350
procsrv::run("",
352-
gdb_path.as_slice(),
351+
gdb_path,
353352
debugger_opts.as_slice(),
354353
vec!((~"",~"")),
355354
None)

branches/try2/src/doc/guide-ffi.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -496,16 +496,3 @@ NUL-terminated string for interoperability with C, you should use the `c_str::to
496496

497497
The standard library includes type aliases and function definitions for the C standard library in
498498
the `libc` module, and Rust links against `libc` and `libm` by default.
499-
500-
# The "nullable pointer optimization"
501-
502-
Certain types are defined to not be `null`. This includes references (`&T`,
503-
`&mut T`), owning pointers (`~T`), and function pointers (`extern "abi"
504-
fn()`). When interfacing with C, pointers that might be null are often used.
505-
As a special case, a generic `enum` that contains exactly two variants, one of
506-
which contains no data and the other containing a single field, is eligible
507-
for the "nullable pointer optimization". When such an enum is instantiated
508-
with one of the non-nullable types, it is represented as a single pointer,
509-
and the non-data variant is represented as the null pointer. So
510-
`Option<extern "C" fn(c_int) -> c_int>` is how one represents a nullable
511-
function pointer using the C ABI.

branches/try2/src/doc/tutorial.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,8 +1579,6 @@ allocated memory on the heap. A unique vector owns the elements it contains, so
15791579
the elements are mutable if the vector is mutable.
15801580
15811581
~~~
1582-
use std::strbuf::StrBuf;
1583-
15841582
// A dynamically sized vector (unique vector)
15851583
let mut numbers = ~[1, 2, 3];
15861584
numbers.push(4);
@@ -1591,7 +1589,7 @@ let more_numbers: ~[int] = numbers;
15911589

15921590
// The original `numbers` value can no longer be used, due to move semantics.
15931591

1594-
let mut string = StrBuf::from_str("fo");
1592+
let mut string = ~"fo";
15951593
string.push_char('o');
15961594
~~~
15971595

branches/try2/src/libcollections/bitv.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ use std::cmp;
1515
use std::iter::RandomAccessIterator;
1616
use std::iter::{Rev, Enumerate, Repeat, Map, Zip};
1717
use std::ops;
18-
use std::slice;
19-
use std::strbuf::StrBuf;
2018
use std::uint;
19+
use std::slice;
2120

2221
#[deriving(Clone)]
2322
struct SmallBitv {
@@ -500,15 +499,15 @@ impl Bitv {
500499
* character is either '0' or '1'.
501500
*/
502501
pub fn to_str(&self) -> ~str {
503-
let mut rs = StrBuf::new();
502+
let mut rs = ~"";
504503
for i in self.iter() {
505504
if i {
506505
rs.push_char('1');
507506
} else {
508507
rs.push_char('0');
509508
}
510509
};
511-
rs.into_owned()
510+
rs
512511
}
513512

514513

branches/try2/src/libcollections/hashmap.rs

Lines changed: 70 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -795,97 +795,6 @@ impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
795795
fn search(&self, k: &K) -> Option<table::FullIndex> {
796796
self.search_hashed(&self.make_hash(k), k)
797797
}
798-
799-
fn pop_internal(&mut self, starting_index: table::FullIndex) -> Option<V> {
800-
let starting_probe = starting_index.raw_index();
801-
802-
let ending_probe = {
803-
let mut probe = self.probe_next(starting_probe);
804-
for _ in range(0u, self.table.size()) {
805-
match self.table.peek(probe) {
806-
table::Empty(_) => {}, // empty bucket. this is the end of our shifting.
807-
table::Full(idx) => {
808-
// Bucket that isn't us, which has a non-zero probe distance.
809-
// This isn't the ending index, so keep searching.
810-
if self.bucket_distance(&idx) != 0 {
811-
probe = self.probe_next(probe);
812-
continue;
813-
}
814-
815-
// if we do have a bucket_distance of zero, we're at the end
816-
// of what we need to shift.
817-
}
818-
}
819-
break;
820-
}
821-
822-
probe
823-
};
824-
825-
let (_, _, retval) = self.table.take(starting_index);
826-
827-
let mut probe = starting_probe;
828-
let mut next_probe = self.probe_next(probe);
829-
830-
// backwards-shift all the elements after our newly-deleted one.
831-
while next_probe != ending_probe {
832-
match self.table.peek(next_probe) {
833-
table::Empty(_) => {
834-
// nothing to shift in. just empty it out.
835-
match self.table.peek(probe) {
836-
table::Empty(_) => {},
837-
table::Full(idx) => { self.table.take(idx); }
838-
}
839-
},
840-
table::Full(next_idx) => {
841-
// something to shift. move it over!
842-
let next_hash = next_idx.hash();
843-
let (_, next_key, next_val) = self.table.take(next_idx);
844-
match self.table.peek(probe) {
845-
table::Empty(idx) => {
846-
self.table.put(idx, next_hash, next_key, next_val);
847-
},
848-
table::Full(idx) => {
849-
let (emptyidx, _, _) = self.table.take(idx);
850-
self.table.put(emptyidx, next_hash, next_key, next_val);
851-
}
852-
}
853-
}
854-
}
855-
856-
probe = next_probe;
857-
next_probe = self.probe_next(next_probe);
858-
}
859-
860-
// Done the backwards shift, but there's still an element left!
861-
// Empty it out.
862-
match self.table.peek(probe) {
863-
table::Empty(_) => {},
864-
table::Full(idx) => { self.table.take(idx); }
865-
}
866-
867-
// Now we're done all our shifting. Return the value we grabbed
868-
// earlier.
869-
return Some(retval);
870-
}
871-
872-
/// Like `pop`, but can operate on any type that is equivalent to a key.
873-
#[experimental]
874-
pub fn pop_equiv<Q:Hash<S> + Equiv<K>>(&mut self, k: &Q) -> Option<V> {
875-
if self.table.size() == 0 {
876-
return None
877-
}
878-
879-
let potential_new_size = self.table.size() - 1;
880-
self.make_some_room(potential_new_size);
881-
882-
let starting_index = match self.search_equiv(k) {
883-
Some(idx) => idx,
884-
None => return None,
885-
};
886-
887-
self.pop_internal(starting_index)
888-
}
889798
}
890799

891800
impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> Container for HashMap<K, V, H> {
@@ -985,9 +894,77 @@ impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> MutableMap<K, V> for HashMap<K, V
985894
None => return None,
986895
};
987896

988-
self.pop_internal(starting_index)
989-
}
897+
let starting_probe = starting_index.raw_index();
898+
899+
let ending_probe = {
900+
let mut probe = self.probe_next(starting_probe);
901+
for _ in range(0u, self.table.size()) {
902+
match self.table.peek(probe) {
903+
table::Empty(_) => {}, // empty bucket. this is the end of our shifting.
904+
table::Full(idx) => {
905+
// Bucket that isn't us, which has a non-zero probe distance.
906+
// This isn't the ending index, so keep searching.
907+
if self.bucket_distance(&idx) != 0 {
908+
probe = self.probe_next(probe);
909+
continue;
910+
}
911+
912+
// if we do have a bucket_distance of zero, we're at the end
913+
// of what we need to shift.
914+
}
915+
}
916+
break;
917+
}
918+
919+
probe
920+
};
990921

922+
let (_, _, retval) = self.table.take(starting_index);
923+
924+
let mut probe = starting_probe;
925+
let mut next_probe = self.probe_next(probe);
926+
927+
// backwards-shift all the elements after our newly-deleted one.
928+
while next_probe != ending_probe {
929+
match self.table.peek(next_probe) {
930+
table::Empty(_) => {
931+
// nothing to shift in. just empty it out.
932+
match self.table.peek(probe) {
933+
table::Empty(_) => {},
934+
table::Full(idx) => { self.table.take(idx); }
935+
}
936+
},
937+
table::Full(next_idx) => {
938+
// something to shift. move it over!
939+
let next_hash = next_idx.hash();
940+
let (_, next_key, next_val) = self.table.take(next_idx);
941+
match self.table.peek(probe) {
942+
table::Empty(idx) => {
943+
self.table.put(idx, next_hash, next_key, next_val);
944+
},
945+
table::Full(idx) => {
946+
let (emptyidx, _, _) = self.table.take(idx);
947+
self.table.put(emptyidx, next_hash, next_key, next_val);
948+
}
949+
}
950+
}
951+
}
952+
953+
probe = next_probe;
954+
next_probe = self.probe_next(next_probe);
955+
}
956+
957+
// Done the backwards shift, but there's still an element left!
958+
// Empty it out.
959+
match self.table.peek(probe) {
960+
table::Empty(_) => {},
961+
table::Full(idx) => { self.table.take(idx); }
962+
}
963+
964+
// Now we're done all our shifting. Return the value we grabbed
965+
// earlier.
966+
return Some(retval);
967+
}
991968
}
992969

993970
impl<K: Hash + TotalEq, V> HashMap<K, V, sip::SipHasher> {
@@ -1594,27 +1571,10 @@ pub type SetAlgebraItems<'a, T, H> =
15941571
#[cfg(test)]
15951572
mod test_map {
15961573
use super::HashMap;
1597-
use std::cmp::Equiv;
1598-
use std::hash::Hash;
15991574
use std::iter::{Iterator,range_inclusive,range_step_inclusive};
16001575
use std::local_data;
16011576
use std::vec;
16021577

1603-
struct KindaIntLike(int);
1604-
1605-
impl Equiv<int> for KindaIntLike {
1606-
fn equiv(&self, other: &int) -> bool {
1607-
let KindaIntLike(this) = *self;
1608-
this == *other
1609-
}
1610-
}
1611-
impl<S: Writer> Hash<S> for KindaIntLike {
1612-
fn hash(&self, state: &mut S) {
1613-
let KindaIntLike(this) = *self;
1614-
this.hash(state)
1615-
}
1616-
}
1617-
16181578
#[test]
16191579
fn test_create_capacity_zero() {
16201580
let mut m = HashMap::with_capacity(0);
@@ -1854,15 +1814,6 @@ mod test_map {
18541814
assert_eq!(m.pop(&1), None);
18551815
}
18561816

1857-
#[test]
1858-
#[allow(experimental)]
1859-
fn test_pop_equiv() {
1860-
let mut m = HashMap::new();
1861-
m.insert(1, 2);
1862-
assert_eq!(m.pop_equiv(&KindaIntLike(1)), Some(2));
1863-
assert_eq!(m.pop_equiv(&KindaIntLike(1)), None);
1864-
}
1865-
18661817
#[test]
18671818
fn test_swap() {
18681819
let mut m = HashMap::new();

0 commit comments

Comments
 (0)