Skip to content

Commit 4849ed4

Browse files
committed
---
yaml --- r: 127995 b: refs/heads/auto c: 8d27232 h: refs/heads/master i: 127993: e04f987 127991: b357fa3 v: v3
1 parent fb08884 commit 4849ed4

Some content is hidden

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

113 files changed

+1164
-922
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 56b86aaf35d96ec8cf8555205426eaed62427963
16+
refs/heads/auto: 8d272321417df3a954802e42a66adda87ade5a49
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/compiletest/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ fn parse_exec_env(line: &str) -> Option<(String, String)> {
233233
parse_name_value_directive(line, "exec-env").map(|nv| {
234234
// nv is either FOO or FOO=BAR
235235
let mut strs: Vec<String> = nv.as_slice()
236-
.splitn(1, '=')
236+
.splitn('=', 1)
237237
.map(|s| s.to_string())
238238
.collect();
239239

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,9 @@ linking to, and in the second case `bar` is the type of native library that the
350350
compiler is linking to. There are currently three known types of native
351351
libraries:
352352
353-
* Dynamic - `#[link(name = "readline")]`
354-
* Static - `#[link(name = "my_build_dependency", kind = "static")]`
355-
* Frameworks - `#[link(name = "CoreFoundation", kind = "framework")]`
353+
* Dynamic - `#[link(name = "readline")]
354+
* Static - `#[link(name = "my_build_dependency", kind = "static")]
355+
* Frameworks - `#[link(name = "CoreFoundation", kind = "framework")]
356356
357357
Note that frameworks are only available on OSX targets.
358358

branches/auto/src/doc/rust.md

Lines changed: 121 additions & 153 deletions
Large diffs are not rendered by default.

branches/auto/src/etc/unicode.py

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,13 @@ def emit_bsearch_range_table(f):
293293
f.write("""
294294
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
295295
use core::cmp::{Equal, Less, Greater};
296-
use core::slice::ImmutableSlice;
297-
r.binary_search(|&(lo,hi)| {
296+
use core::slice::ImmutableVector;
297+
use core::option::None;
298+
r.bsearch(|&(lo,hi)| {
298299
if lo <= c && c <= hi { Equal }
299300
else if hi < c { Less }
300301
else { Greater }
301-
}).found().is_some()
302+
}) != None
302303
}\n
303304
""")
304305

@@ -351,10 +352,9 @@ def emit_conversions_module(f, lowerupper, upperlower):
351352
f.write("pub mod conversions {")
352353
f.write("""
353354
use core::cmp::{Equal, Less, Greater};
354-
use core::slice::ImmutableSlice;
355+
use core::slice::ImmutableVector;
355356
use core::tuple::Tuple2;
356357
use core::option::{Option, Some, None};
357-
use core::slice;
358358
359359
pub fn to_lower(c: char) -> char {
360360
match bsearch_case_table(c, LuLl_table) {
@@ -371,14 +371,11 @@ def emit_conversions_module(f, lowerupper, upperlower):
371371
}
372372
373373
fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option<uint> {
374-
match table.binary_search(|&(key, _)| {
374+
table.bsearch(|&(key, _)| {
375375
if c == key { Equal }
376376
else if key < c { Less }
377377
else { Greater }
378-
}) {
379-
slice::Found(i) => Some(i),
380-
slice::NotFound(_) => None,
381-
}
378+
})
382379
}
383380
384381
""")
@@ -390,8 +387,8 @@ def emit_conversions_module(f, lowerupper, upperlower):
390387

391388
def emit_grapheme_module(f, grapheme_table, grapheme_cats):
392389
f.write("""pub mod grapheme {
393-
use core::slice::ImmutableSlice;
394-
use core::slice;
390+
use core::option::{Some, None};
391+
use core::slice::ImmutableVector;
395392
396393
#[allow(non_camel_case_types)]
397394
#[deriving(Clone)]
@@ -403,16 +400,16 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
403400
404401
fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
405402
use core::cmp::{Equal, Less, Greater};
406-
match r.binary_search(|&(lo, hi, _)| {
403+
match r.bsearch(|&(lo, hi, _)| {
407404
if lo <= c && c <= hi { Equal }
408405
else if hi < c { Less }
409406
else { Greater }
410407
}) {
411-
slice::Found(idx) => {
408+
Some(idx) => {
412409
let (_, _, cat) = r[idx];
413410
cat
414411
}
415-
slice::NotFound(_) => GC_Any
412+
None => GC_Any
416413
}
417414
}
418415
@@ -430,21 +427,20 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
430427
def emit_charwidth_module(f, width_table):
431428
f.write("pub mod charwidth {\n")
432429
f.write(" use core::option::{Option, Some, None};\n")
433-
f.write(" use core::slice::ImmutableSlice;\n")
434-
f.write(" use core::slice;\n")
430+
f.write(" use core::slice::ImmutableVector;\n")
435431
f.write("""
436432
fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 {
437433
use core::cmp::{Equal, Less, Greater};
438-
match r.binary_search(|&(lo, hi, _, _)| {
434+
match r.bsearch(|&(lo, hi, _, _)| {
439435
if lo <= c && c <= hi { Equal }
440436
else if hi < c { Less }
441437
else { Greater }
442438
}) {
443-
slice::Found(idx) => {
439+
Some(idx) => {
444440
let (_, _, r_ncjk, r_cjk) = r[idx];
445441
if is_cjk { r_cjk } else { r_ncjk }
446442
}
447-
slice::NotFound(_) => 1
443+
None => 1
448444
}
449445
}
450446
""")
@@ -529,19 +525,19 @@ def comp_pfun(char):
529525

530526
f.write("""
531527
fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 {
528+
use core::option::{Some, None};
532529
use core::cmp::{Equal, Less, Greater};
533-
use core::slice::ImmutableSlice;
534-
use core::slice;
535-
match r.binary_search(|&(lo, hi, _)| {
530+
use core::slice::ImmutableVector;
531+
match r.bsearch(|&(lo, hi, _)| {
536532
if lo <= c && c <= hi { Equal }
537533
else if hi < c { Less }
538534
else { Greater }
539535
}) {
540-
slice::Found(idx) => {
536+
Some(idx) => {
541537
let (_, _, result) = r[idx];
542538
result
543539
}
544-
slice::NotFound(_) => 0
540+
None => 0
545541
}
546542
}\n
547543
""")

branches/auto/src/libcollections/hash/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ mod tests {
296296
use std::prelude::*;
297297
use std::mem;
298298

299-
use slice::ImmutableSlice;
299+
use slice::ImmutableVector;
300300
use super::{Hash, Hasher, Writer};
301301

302302
struct MyWriterHasher;

branches/auto/src/libcollections/hash/sip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ mod tests {
275275

276276
use str::Str;
277277
use string::String;
278-
use slice::{Slice, ImmutableSlice};
278+
use slice::{Vector, ImmutableVector};
279279
use vec::Vec;
280280

281281
use super::super::{Hash, Writer};

branches/auto/src/libcollections/ringbuf.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ pub struct MutItems<'a, T> {
362362

363363
impl<'a, T> Iterator<&'a mut T> for MutItems<'a, T> {
364364
#[inline]
365-
#[allow(deprecated)] // mut_shift_ref
366365
fn next(&mut self) -> Option<&'a mut T> {
367366
if self.nelts == 0 {
368367
return None;
@@ -385,7 +384,6 @@ impl<'a, T> Iterator<&'a mut T> for MutItems<'a, T> {
385384

386385
impl<'a, T> DoubleEndedIterator<&'a mut T> for MutItems<'a, T> {
387386
#[inline]
388-
#[allow(deprecated)] // mut_shift_ref
389387
fn next_back(&mut self) -> Option<&'a mut T> {
390388
if self.nelts == 0 {
391389
return None;

branches/auto/src/libcollections/slice.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ represents iteration over a slice.
4545
## Traits
4646
4747
A number of traits add methods that allow you to accomplish tasks with slices.
48-
These traits include `ImmutableSlice`, which is defined for `&[T]` types,
49-
and `MutableSlice`, defined for `&mut [T]` types.
48+
These traits include `ImmutableVector`, which is defined for `&[T]` types,
49+
and `MutableVector`, defined for `&mut [T]` types.
5050
5151
An example is the method `.slice(a, b)` that returns an immutable "view" into
5252
a `Vec` or another slice from the index interval `[a, b)`:
@@ -98,11 +98,10 @@ use {Collection, MutableSeq};
9898
use vec::Vec;
9999

100100
pub use core::slice::{ref_slice, mut_ref_slice, Splits, Windows};
101-
pub use core::slice::{Chunks, Slice, ImmutableSlice, ImmutablePartialEqSlice};
102-
pub use core::slice::{ImmutableOrdSlice, MutableSlice, Items, MutItems};
101+
pub use core::slice::{Chunks, Vector, ImmutableVector, ImmutableEqVector};
102+
pub use core::slice::{ImmutableOrdVector, MutableVector, Items, MutItems};
103103
pub use core::slice::{MutSplits, MutChunks};
104-
pub use core::slice::{bytes, MutableCloneableSlice};
105-
pub use core::slice::{BinarySearchResult, Found, NotFound};
104+
pub use core::slice::{bytes, MutableCloneableVector};
106105

107106
// Functional utilities
108107

@@ -117,7 +116,7 @@ pub trait VectorVector<T> {
117116
fn connect_vec(&self, sep: &T) -> Vec<T>;
118117
}
119118

120-
impl<'a, T: Clone, V: Slice<T>> VectorVector<T> for &'a [V] {
119+
impl<'a, T: Clone, V: Vector<T>> VectorVector<T> for &'a [V] {
121120
fn concat_vec(&self) -> Vec<T> {
122121
let size = self.iter().fold(0u, |acc, v| acc + v.as_slice().len());
123122
let mut result = Vec::with_capacity(size);
@@ -559,7 +558,7 @@ fn merge_sort<T>(v: &mut [T], compare: |&T, &T| -> Ordering) {
559558

560559
/// Extension methods for vectors such that their elements are
561560
/// mutable.
562-
pub trait MutableSliceAllocating<'a, T> {
561+
pub trait MutableVectorAllocating<'a, T> {
563562
/// Sort the vector, in place, using `compare` to compare
564563
/// elements.
565564
///
@@ -605,7 +604,7 @@ pub trait MutableSliceAllocating<'a, T> {
605604
fn move_from(self, src: Vec<T>, start: uint, end: uint) -> uint;
606605
}
607606

608-
impl<'a,T> MutableSliceAllocating<'a, T> for &'a mut [T] {
607+
impl<'a,T> MutableVectorAllocating<'a, T> for &'a mut [T] {
609608
#[inline]
610609
fn sort_by(self, compare: |&T, &T| -> Ordering) {
611610
merge_sort(self, compare)
@@ -622,7 +621,7 @@ impl<'a,T> MutableSliceAllocating<'a, T> for &'a mut [T] {
622621

623622
/// Methods for mutable vectors with orderable elements, such as
624623
/// in-place sorting.
625-
pub trait MutableOrdSlice<T> {
624+
pub trait MutableOrdVector<T> {
626625
/// Sort the vector, in place.
627626
///
628627
/// This is equivalent to `self.sort_by(|a, b| a.cmp(b))`.
@@ -668,7 +667,7 @@ pub trait MutableOrdSlice<T> {
668667
fn prev_permutation(self) -> bool;
669668
}
670669

671-
impl<'a, T: Ord> MutableOrdSlice<T> for &'a mut [T] {
670+
impl<'a, T: Ord> MutableOrdVector<T> for &'a mut [T] {
672671
#[inline]
673672
fn sort(self) {
674673
self.sort_by(|a,b| a.cmp(b))

branches/auto/src/libcollections/str.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ mod tests {
894894
use {Collection, MutableSeq};
895895

896896
use super::*;
897-
use std::slice::{Slice, ImmutableSlice};
897+
use std::slice::{Vector, ImmutableVector};
898898
use string::String;
899899
use vec::Vec;
900900

@@ -1812,38 +1812,38 @@ mod tests {
18121812
fn test_splitn_char_iterator() {
18131813
let data = "\nMäry häd ä little lämb\nLittle lämb\n";
18141814

1815-
let split: Vec<&str> = data.splitn(3, ' ').collect();
1815+
let split: Vec<&str> = data.splitn(' ', 3).collect();
18161816
assert_eq!(split, vec!["\nMäry", "häd", "ä", "little lämb\nLittle lämb\n"]);
18171817

1818-
let split: Vec<&str> = data.splitn(3, |c: char| c == ' ').collect();
1818+
let split: Vec<&str> = data.splitn(|c: char| c == ' ', 3).collect();
18191819
assert_eq!(split, vec!["\nMäry", "häd", "ä", "little lämb\nLittle lämb\n"]);
18201820

18211821
// Unicode
1822-
let split: Vec<&str> = data.splitn(3, 'ä').collect();
1822+
let split: Vec<&str> = data.splitn('ä', 3).collect();
18231823
assert_eq!(split, vec!["\nM", "ry h", "d ", " little lämb\nLittle lämb\n"]);
18241824

1825-
let split: Vec<&str> = data.splitn(3, |c: char| c == 'ä').collect();
1825+
let split: Vec<&str> = data.splitn(|c: char| c == 'ä', 3).collect();
18261826
assert_eq!(split, vec!["\nM", "ry h", "d ", " little lämb\nLittle lämb\n"]);
18271827
}
18281828

18291829
#[test]
18301830
fn test_rsplitn_char_iterator() {
18311831
let data = "\nMäry häd ä little lämb\nLittle lämb\n";
18321832

1833-
let mut split: Vec<&str> = data.rsplitn(3, ' ').collect();
1833+
let mut split: Vec<&str> = data.rsplitn(' ', 3).collect();
18341834
split.reverse();
18351835
assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]);
18361836

1837-
let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == ' ').collect();
1837+
let mut split: Vec<&str> = data.rsplitn(|c: char| c == ' ', 3).collect();
18381838
split.reverse();
18391839
assert_eq!(split, vec!["\nMäry häd ä", "little", "lämb\nLittle", "lämb\n"]);
18401840

18411841
// Unicode
1842-
let mut split: Vec<&str> = data.rsplitn(3, 'ä').collect();
1842+
let mut split: Vec<&str> = data.rsplitn('ä', 3).collect();
18431843
split.reverse();
18441844
assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]);
18451845

1846-
let mut split: Vec<&str> = data.rsplitn(3, |c: char| c == 'ä').collect();
1846+
let mut split: Vec<&str> = data.rsplitn(|c: char| c == 'ä', 3).collect();
18471847
split.reverse();
18481848
assert_eq!(split, vec!["\nMäry häd ", " little l", "mb\nLittle l", "mb\n"]);
18491849
}

branches/auto/src/libcollections/string.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,12 @@ use core::default::Default;
1818
use core::fmt;
1919
use core::mem;
2020
use core::ptr;
21-
// FIXME: ICE's abound if you import the `Slice` type while importing `Slice` trait
22-
use RawSlice = core::raw::Slice;
23-
use core::slice::Slice;
21+
use core::raw::Slice;
2422

2523
use {Collection, Mutable, MutableSeq};
2624
use hash;
2725
use str;
28-
use str::{CharRange, StrAllocating, MaybeOwned, Owned};
29-
use MaybeOwnedSlice = str::Slice; // So many `Slice`s...
26+
use str::{CharRange, StrAllocating, MaybeOwned, Owned, Slice};
3027
use vec::Vec;
3128

3229
/// A growable string stored as a UTF-8 encoded buffer.
@@ -133,15 +130,15 @@ impl String {
133130
/// ```
134131
pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> MaybeOwned<'a> {
135132
if str::is_utf8(v) {
136-
return MaybeOwnedSlice(unsafe { mem::transmute(v) })
133+
return Slice(unsafe { mem::transmute(v) })
137134
}
138135

139136
static TAG_CONT_U8: u8 = 128u8;
140137
static REPLACEMENT: &'static [u8] = b"\xEF\xBF\xBD"; // U+FFFD in UTF-8
141138
let mut i = 0;
142139
let total = v.len();
143140
fn unsafe_get(xs: &[u8], i: uint) -> u8 {
144-
unsafe { *xs.unsafe_get(i) }
141+
unsafe { *xs.unsafe_ref(i) }
145142
}
146143
fn safe_get(xs: &[u8], i: uint, total: uint) -> u8 {
147144
if i >= total {
@@ -499,7 +496,7 @@ impl String {
499496
unsafe {
500497
// Attempt to not use an intermediate buffer by just pushing bytes
501498
// directly onto this string.
502-
let slice = RawSlice {
499+
let slice = Slice {
503500
data: self.vec.as_ptr().offset(cur_len as int),
504501
len: 4,
505502
};

branches/auto/src/libcollections/trie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ macro_rules! iterator_impl {
926926
// such thing as invalid pointers and memory unsafety. The
927927
// reason is performance, without doing this we can get the
928928
// bench_iter_large microbenchmark down to about 30000 ns/iter
929-
// (using .unsafe_get to index self.stack directly, 38000
929+
// (using .unsafe_ref to index self.stack directly, 38000
930930
// ns/iter with [] checked indexing), but this smashes that down
931931
// to 13500 ns/iter.
932932
//

0 commit comments

Comments
 (0)