diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-10-02 14:49:26 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-10-02 14:49:26 -0700 |
| commit | b58f77e234ef40c4f19f9dc44c2be2c21163f851 (patch) | |
| tree | d39de6be5866c0f0f37f9f3219b8217c873d8b52 /src/test | |
| parent | b2d4eb186e99b66051be9089f836c66a558dd995 (diff) | |
| parent | d2ea0315e09cbd495a67c9e3d5053b57e2b5a8b7 (diff) | |
| download | rust-b58f77e234ef40c4f19f9dc44c2be2c21163f851.tar.gz rust-b58f77e234ef40c4f19f9dc44c2be2c21163f851.zip | |
rollup merge of #17715 : aturon/revert-slice-ops-libs
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/bench/shootout-fannkuch-redux.rs | 8 | ||||
| -rw-r--r-- | src/test/bench/shootout-fasta-redux.rs | 8 | ||||
| -rw-r--r-- | src/test/bench/shootout-fasta.rs | 4 | ||||
| -rw-r--r-- | src/test/bench/shootout-k-nucleotide-pipes.rs | 6 | ||||
| -rw-r--r-- | src/test/bench/shootout-k-nucleotide.rs | 6 | ||||
| -rw-r--r-- | src/test/bench/shootout-regex-dna.rs | 2 | ||||
| -rw-r--r-- | src/test/bench/shootout-reverse-complement.rs | 4 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-15730.rs | 4 | ||||
| -rw-r--r-- | src/test/compile-fail/slice-2.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/slice-borrow.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/slice-mut-2.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/slice-mut.rs | 2 | ||||
| -rw-r--r-- | src/test/debuginfo/vec-slices.rs | 3 | ||||
| -rw-r--r-- | src/test/run-pass/issue-3888-2.rs | 4 | ||||
| -rw-r--r-- | src/test/run-pass/issue-4464.rs | 4 | ||||
| -rw-r--r-- | src/test/run-pass/issue-8898.rs | 3 | ||||
| -rw-r--r-- | src/test/run-pass/slice-2.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/slice-fail-1.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/slice-fail-2.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/slice.rs | 18 |
20 files changed, 26 insertions, 62 deletions
diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs index b4292c2b050..5e812e500d6 100644 --- a/src/test/bench/shootout-fannkuch-redux.rs +++ b/src/test/bench/shootout-fannkuch-redux.rs @@ -38,8 +38,6 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. -#![feature(slicing_syntax)] - use std::{cmp, iter, mem}; use std::sync::Future; @@ -52,7 +50,7 @@ fn rotate(x: &mut [i32]) { fn next_permutation(perm: &mut [i32], count: &mut [i32]) { for i in range(1, perm.len()) { - rotate(perm[mut ..i + 1]); + rotate(perm.slice_to_mut(i + 1)); let count_i = &mut count[i]; if *count_i >= i as i32 { *count_i = 0; @@ -101,7 +99,7 @@ impl Perm { let d = idx / self.fact[i] as i32; self.cnt[i] = d; idx %= self.fact[i] as i32; - for (place, val) in pp.iter_mut().zip(self.perm.p[..i+1].iter()) { + for (place, val) in pp.iter_mut().zip(self.perm.p.slice_to(i + 1).iter()) { *place = (*val) as u8 } @@ -127,7 +125,7 @@ impl Perm { fn reverse(tperm: &mut [i32], mut k: uint) { - tperm[mut ..k].reverse() + tperm.slice_to_mut(k).reverse() } fn work(mut perm: Perm, n: uint, max: uint) -> (i32, i32) { diff --git a/src/test/bench/shootout-fasta-redux.rs b/src/test/bench/shootout-fasta-redux.rs index b8af76ce17c..b68404bdd72 100644 --- a/src/test/bench/shootout-fasta-redux.rs +++ b/src/test/bench/shootout-fasta-redux.rs @@ -38,8 +38,6 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. -#![feature(slicing_syntax)] - use std::cmp::min; use std::io::{stdout, IoResult}; use std::os; @@ -126,8 +124,8 @@ impl<'a, W: Writer> RepeatFasta<'a, W> { copy_memory(buf.as_mut_slice(), alu); let buf_len = buf.len(); - copy_memory(buf[mut alu_len..buf_len], - alu[..LINE_LEN]); + copy_memory(buf.slice_mut(alu_len, buf_len), + alu.slice_to(LINE_LEN)); let mut pos = 0; let mut bytes; @@ -203,7 +201,7 @@ impl<'a, W: Writer> RandomFasta<'a, W> { for i in range(0u, chars_left) { buf[i] = self.nextc(); } - self.out.write(buf[..chars_left]) + self.out.write(buf.slice_to(chars_left)) } } diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs index 7565525bc8c..e5ddcac1e8f 100644 --- a/src/test/bench/shootout-fasta.rs +++ b/src/test/bench/shootout-fasta.rs @@ -38,8 +38,6 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. -#![feature(slicing_syntax)] - use std::io; use std::io::{BufferedWriter, File}; use std::cmp::min; @@ -95,7 +93,7 @@ fn make_fasta<W: Writer, I: Iterator<u8>>( } n -= nb; line[nb] = '\n' as u8; - wr.write(line[..nb+1]); + wr.write(line.slice_to(nb + 1)); } } diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 86c1bd82e9f..f4d1cee5fb4 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -13,8 +13,6 @@ // multi tasking k-nucleotide -#![feature(slicing_syntax)] - extern crate collections; use std::collections::HashMap; @@ -99,11 +97,11 @@ fn windows_with_carry(bb: &[u8], nn: uint, it: |window: &[u8]|) -> Vec<u8> { let len = bb.len(); while ii < len - (nn - 1u) { - it(bb[ii..ii+nn]); + it(bb.slice(ii, ii+nn)); ii += 1u; } - return Vec::from_slice(bb[len - (nn - 1u)..len]); + return Vec::from_slice(bb.slice(len - (nn - 1u), len)); } fn make_sequence_processor(sz: uint, diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 8c08fc4caa1..cecc95354af 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -40,8 +40,6 @@ // ignore-android see #10393 #13206 -#![feature(slicing_syntax)] - use std::string::String; use std::slice; use std::sync::{Arc, Future}; @@ -242,14 +240,14 @@ fn generate_frequencies(mut input: &[u8], frame: uint) -> Table { // Pull first frame. for _ in range(0, frame) { code = code.push_char(input[0]); - input = input[1..]; + input = input.slice_from(1); } frequencies.lookup(code, BumpCallback); while input.len() != 0 && input[0] != ('>' as u8) { code = code.rotate(input[0], frame); frequencies.lookup(code, BumpCallback); - input = input[1..]; + input = input.slice_from(1); } frequencies } diff --git a/src/test/bench/shootout-regex-dna.rs b/src/test/bench/shootout-regex-dna.rs index dccdafe9cf8..0adb80c2689 100644 --- a/src/test/bench/shootout-regex-dna.rs +++ b/src/test/bench/shootout-regex-dna.rs @@ -41,7 +41,7 @@ // ignore-stage1 // ignore-cross-compile #12102 -#![feature(macro_rules, phase, slicing_syntax)] +#![feature(macro_rules, phase)] extern crate regex; #[phase(plugin)]extern crate regex_macros; diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs index e3fa6334f77..e522bcaf4db 100644 --- a/src/test/bench/shootout-reverse-complement.rs +++ b/src/test/bench/shootout-reverse-complement.rs @@ -41,8 +41,6 @@ // ignore-pretty very bad with line comments // ignore-android doesn't terminate? -#![feature(slicing_syntax)] - use std::iter::range_step; use std::io::{stdin, stdout, File}; @@ -83,7 +81,7 @@ fn main() { Some(c) => c }; let len = seq.len(); - let seq = seq[mut begin+1..len-1]; + let seq = seq.slice_mut(begin + 1, len - 1); // arrange line breaks let len = seq.len(); diff --git a/src/test/compile-fail/issue-15730.rs b/src/test/compile-fail/issue-15730.rs index c29e74af03c..6cddd8ee939 100644 --- a/src/test/compile-fail/issue-15730.rs +++ b/src/test/compile-fail/issue-15730.rs @@ -8,10 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slicing_syntax)] - fn main() { let mut array = [1, 2, 3]; //~^ ERROR cannot determine a type for this local variable: cannot determine the type of this integ - let pie_slice = array[1..2]; + let pie_slice = array.slice(1, 2); } diff --git a/src/test/compile-fail/slice-2.rs b/src/test/compile-fail/slice-2.rs index 63f79c808ae..fbfc438321c 100644 --- a/src/test/compile-fail/slice-2.rs +++ b/src/test/compile-fail/slice-2.rs @@ -10,8 +10,6 @@ // Test that slicing syntax gives errors if we have not implemented the trait. -#![feature(slicing_syntax)] - struct Foo; fn main() { diff --git a/src/test/compile-fail/slice-borrow.rs b/src/test/compile-fail/slice-borrow.rs index 00783b71ea1..3d12511134f 100644 --- a/src/test/compile-fail/slice-borrow.rs +++ b/src/test/compile-fail/slice-borrow.rs @@ -10,8 +10,6 @@ // Test slicing expressions doesn't defeat the borrow checker. -#![feature(slicing_syntax)] - fn main() { let y; { diff --git a/src/test/compile-fail/slice-mut-2.rs b/src/test/compile-fail/slice-mut-2.rs index 09019448a67..1176b637cec 100644 --- a/src/test/compile-fail/slice-mut-2.rs +++ b/src/test/compile-fail/slice-mut-2.rs @@ -10,8 +10,6 @@ // Test mutability and slicing syntax. -#![feature(slicing_syntax)] - fn main() { let x: &[int] = &[1, 2, 3, 4, 5]; // Can't mutably slice an immutable slice diff --git a/src/test/compile-fail/slice-mut.rs b/src/test/compile-fail/slice-mut.rs index cbfa3ed85fd..8cd7c4ed0bb 100644 --- a/src/test/compile-fail/slice-mut.rs +++ b/src/test/compile-fail/slice-mut.rs @@ -10,8 +10,6 @@ // Test mutability and slicing syntax. -#![feature(slicing_syntax)] - fn main() { let x: &[int] = &[1, 2, 3, 4, 5]; // Immutable slices are not mutable. diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs index 67e621fe556..ba8c4d249ce 100644 --- a/src/test/debuginfo/vec-slices.rs +++ b/src/test/debuginfo/vec-slices.rs @@ -80,7 +80,6 @@ // lldb-check:[...]$5 = &[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }] #![allow(unused_variable)] -#![feature(slicing_syntax)] struct AStruct { x: i16, @@ -95,7 +94,7 @@ fn main() { let empty: &[i64] = &[]; let singleton: &[i64] = &[1]; let multiple: &[i64] = &[2, 3, 4, 5]; - let slice_of_slice = multiple[1..3]; + let slice_of_slice = multiple.slice(1,3); let padded_tuple: &[(i32, i16)] = &[(6, 7), (8, 9)]; diff --git a/src/test/run-pass/issue-3888-2.rs b/src/test/run-pass/issue-3888-2.rs index 10add853ee7..c9f6733fa25 100644 --- a/src/test/run-pass/issue-3888-2.rs +++ b/src/test/run-pass/issue-3888-2.rs @@ -8,10 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slicing_syntax)] - fn vec_peek<'r, T>(v: &'r [T]) -> &'r [T] { - v[1..5] + v.slice(1, 5) } pub fn main() {} diff --git a/src/test/run-pass/issue-4464.rs b/src/test/run-pass/issue-4464.rs index f2c1a715b51..822fda8a18e 100644 --- a/src/test/run-pass/issue-4464.rs +++ b/src/test/run-pass/issue-4464.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slicing_syntax)] - -fn broken(v: &[u8], i: uint, j: uint) -> &[u8] { v[i..j] } +fn broken(v: &[u8], i: uint, j: uint) -> &[u8] { v.slice(i, j) } pub fn main() {} diff --git a/src/test/run-pass/issue-8898.rs b/src/test/run-pass/issue-8898.rs index f2dcaa4a31e..dea352833f0 100644 --- a/src/test/run-pass/issue-8898.rs +++ b/src/test/run-pass/issue-8898.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slicing_syntax)] extern crate debug; @@ -22,7 +21,7 @@ pub fn main() { let abc = [1i, 2, 3]; let tf = [true, false]; let x = [(), ()]; - let slice = x[0..1]; + let slice = x.slice(0,1); let z = box(GC) x; assert_repr_eq(abc, "[1, 2, 3]".to_string()); diff --git a/src/test/run-pass/slice-2.rs b/src/test/run-pass/slice-2.rs index 768c28cb8de..3c0933a055c 100644 --- a/src/test/run-pass/slice-2.rs +++ b/src/test/run-pass/slice-2.rs @@ -10,8 +10,6 @@ // Test slicing expressions on slices and Vecs. -#![feature(slicing_syntax)] - fn main() { let x: &[int] = &[1, 2, 3, 4, 5]; let cmp: &[int] = &[1, 2, 3, 4, 5]; diff --git a/src/test/run-pass/slice-fail-1.rs b/src/test/run-pass/slice-fail-1.rs index b07cf595968..f6972023a72 100644 --- a/src/test/run-pass/slice-fail-1.rs +++ b/src/test/run-pass/slice-fail-1.rs @@ -10,8 +10,6 @@ // Test that is a slicing expr[..] fails, the correct cleanups happen. -#![feature(slicing_syntax)] - use std::task; struct Foo; diff --git a/src/test/run-pass/slice-fail-2.rs b/src/test/run-pass/slice-fail-2.rs index a2aecc1d5cd..cbe65fcd83d 100644 --- a/src/test/run-pass/slice-fail-2.rs +++ b/src/test/run-pass/slice-fail-2.rs @@ -10,8 +10,6 @@ // Test that is a slicing expr[..] fails, the correct cleanups happen. -#![feature(slicing_syntax)] - use std::task; struct Foo; diff --git a/src/test/run-pass/slice.rs b/src/test/run-pass/slice.rs index 2b4251b4089..39feb075add 100644 --- a/src/test/run-pass/slice.rs +++ b/src/test/run-pass/slice.rs @@ -10,8 +10,6 @@ // Test slicing sugar. -#![feature(slicing_syntax)] - extern crate core; use core::ops::{Slice,SliceMut}; @@ -20,38 +18,38 @@ static mut COUNT: uint = 0; struct Foo; impl Slice<Foo, Foo> for Foo { - fn as_slice<'a>(&'a self) -> &'a Foo { + fn as_slice_<'a>(&'a self) -> &'a Foo { unsafe { COUNT += 1; } self } - fn slice_from<'a>(&'a self, _from: &Foo) -> &'a Foo { + fn slice_from_<'a>(&'a self, _from: &Foo) -> &'a Foo { unsafe { COUNT += 1; } self } - fn slice_to<'a>(&'a self, _to: &Foo) -> &'a Foo { + fn slice_to_<'a>(&'a self, _to: &Foo) -> &'a Foo { unsafe { COUNT += 1; } self } - fn slice<'a>(&'a self, _from: &Foo, _to: &Foo) -> &'a Foo { + fn slice_<'a>(&'a self, _from: &Foo, _to: &Foo) -> &'a Foo { unsafe { COUNT += 1; } self } } impl SliceMut<Foo, Foo> for Foo { - fn as_mut_slice<'a>(&'a mut self) -> &'a mut Foo { + fn as_mut_slice_<'a>(&'a mut self) -> &'a mut Foo { unsafe { COUNT += 1; } self } - fn slice_from_mut<'a>(&'a mut self, _from: &Foo) -> &'a mut Foo { + fn slice_from_mut_<'a>(&'a mut self, _from: &Foo) -> &'a mut Foo { unsafe { COUNT += 1; } self } - fn slice_to_mut<'a>(&'a mut self, _to: &Foo) -> &'a mut Foo { + fn slice_to_mut_<'a>(&'a mut self, _to: &Foo) -> &'a mut Foo { unsafe { COUNT += 1; } self } - fn slice_mut<'a>(&'a mut self, _from: &Foo, _to: &Foo) -> &'a mut Foo { + fn slice_mut_<'a>(&'a mut self, _from: &Foo, _to: &Foo) -> &'a mut Foo { unsafe { COUNT += 1; } self } |
