Skip to content

Commit f08af9a

Browse files
committed
RIMOV, round 5
find ./ -type f -name "*.rs" -exec sed -i "s/\&\[mut /\&mut \[/g" {} \;
1 parent 12e8151 commit f08af9a

22 files changed

+64
-60
lines changed

src/libcore/dvec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl<A> DVec<A> {
223223
}
224224
225225
/// Gives access to the vector as a slice with mutable contents
226-
fn borrow_mut<R>(op: fn(x: &[mut A]) -> R) -> R {
226+
fn borrow_mut<R>(op: fn(x: &mut [A]) -> R) -> R {
227227
do self.check_out |v| {
228228
let mut v = move v;
229229
let result = op(v);

src/libcore/io.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub trait Reader {
5959
/// Read up to len bytes (or EOF) and put them into bytes (which
6060
/// must be at least len bytes long). Return number of bytes read.
6161
// FIXME (#2982): This should probably return an error.
62-
fn read(&self, bytes: &[mut u8], len: uint) -> uint;
62+
fn read(&self, bytes: &mut [u8], len: uint) -> uint;
6363

6464
/// Read a single byte, returning a negative value for EOF or read error.
6565
fn read_byte(&self) -> int;
@@ -419,7 +419,7 @@ fn convert_whence(whence: SeekStyle) -> i32 {
419419
}
420420

421421
impl *libc::FILE: Reader {
422-
fn read(&self, bytes: &[mut u8], len: uint) -> uint {
422+
fn read(&self, bytes: &mut [u8], len: uint) -> uint {
423423
unsafe {
424424
do vec::as_mut_buf(bytes) |buf_p, buf_len| {
425425
assert buf_len >= len;
@@ -464,7 +464,7 @@ struct Wrapper<T, C> {
464464
// duration of its lifetime.
465465
// FIXME there really should be a better way to do this // #2004
466466
impl<R: Reader, C> Wrapper<R, C>: Reader {
467-
fn read(&self, bytes: &[mut u8], len: uint) -> uint {
467+
fn read(&self, bytes: &mut [u8], len: uint) -> uint {
468468
self.base.read(bytes, len)
469469
}
470470
fn read_byte(&self) -> int { self.base.read_byte() }
@@ -531,7 +531,7 @@ pub struct BytesReader {
531531
}
532532
533533
impl BytesReader: Reader {
534-
fn read(&self, bytes: &[mut u8], len: uint) -> uint {
534+
fn read(&self, bytes: &mut [u8], len: uint) -> uint {
535535
let count = uint::min(len, self.bytes.len() - self.pos);
536536
537537
let view = vec::view(self.bytes, self.pos, self.bytes.len());

src/libcore/rand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl Rng {
254254
}
255255

256256
/// Shuffle a mutable vec in place
257-
fn shuffle_mut<T>(values: &[mut T]) {
257+
fn shuffle_mut<T>(values: &mut [T]) {
258258
let mut i = values.len();
259259
while i >= 2u {
260260
// invariant: elements with index >= i have been locked in place.

src/libcore/vec.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,12 +1263,12 @@ pub pure fn zip<T, U>(v: ~[T], u: ~[U]) -> ~[(T, U)] {
12631263
* * a - The index of the first element
12641264
* * b - The index of the second element
12651265
*/
1266-
pub fn swap<T>(v: &[mut T], a: uint, b: uint) {
1266+
pub fn swap<T>(v: &mut [T], a: uint, b: uint) {
12671267
v[a] <-> v[b];
12681268
}
12691269

12701270
/// Reverse the order of elements in a vector, in place
1271-
pub fn reverse<T>(v: &[mut T]) {
1271+
pub fn reverse<T>(v: &mut [T]) {
12721272
let mut i: uint = 0;
12731273
let ln = len::<T>(v);
12741274
while i < ln / 2 { v[i] <-> v[ln - i - 1]; i += 1; }
@@ -1349,7 +1349,7 @@ pub pure fn each<T>(v: &r/[T], f: fn(&r/T) -> bool) {
13491349
/// a vector with mutable contents and you would like
13501350
/// to mutate the contents as you iterate.
13511351
#[inline(always)]
1352-
pub fn each_mut<T>(v: &[mut T], f: fn(elem: &mut T) -> bool) {
1352+
pub fn each_mut<T>(v: &mut [T], f: fn(elem: &mut T) -> bool) {
13531353
let mut i = 0;
13541354
let n = v.len();
13551355
while i < n {
@@ -1519,7 +1519,7 @@ pub pure fn as_const_buf<T,U>(s: &[const T],
15191519

15201520
/// Similar to `as_imm_buf` but passing a `*mut T`
15211521
#[inline(always)]
1522-
pub pure fn as_mut_buf<T,U>(s: &[mut T],
1522+
pub pure fn as_mut_buf<T,U>(s: &mut [T],
15231523
f: fn(*mut T, uint) -> U) -> U {
15241524

15251525
unsafe {
@@ -2066,7 +2066,7 @@ pub mod raw {
20662066

20672067
/** see `to_ptr()` */
20682068
#[inline(always)]
2069-
pub unsafe fn to_mut_ptr<T>(v: &[mut T]) -> *mut T {
2069+
pub unsafe fn to_mut_ptr<T>(v: &mut [T]) -> *mut T {
20702070
let repr: **SliceRepr = ::cast::transmute(&v);
20712071
return ::cast::reinterpret_cast(&addr_of(&((**repr).data)));
20722072
}
@@ -2099,7 +2099,7 @@ pub mod raw {
20992099
* is newly allocated.
21002100
*/
21012101
#[inline(always)]
2102-
pub unsafe fn init_elem<T>(v: &[mut T], i: uint, val: T) {
2102+
pub unsafe fn init_elem<T>(v: &mut [T], i: uint, val: T) {
21032103
let mut box = Some(val);
21042104
do as_mut_buf(v) |p, _len| {
21052105
let mut box2 = None;
@@ -2133,7 +2133,7 @@ pub mod raw {
21332133
* may overlap.
21342134
*/
21352135
#[inline(always)]
2136-
pub unsafe fn copy_memory<T>(dst: &[mut T], src: &[const T],
2136+
pub unsafe fn copy_memory<T>(dst: &mut [T], src: &[const T],
21372137
count: uint) {
21382138
assert dst.len() >= count;
21392139
assert src.len() >= count;
@@ -2199,8 +2199,12 @@ pub mod bytes {
21992199
* Copies `count` bytes from `src` to `dst`. The source and destination
22002200
* may overlap.
22012201
*/
2202+
<<<<<<< HEAD
22022203
#[inline(always)]
22032204
pub fn copy_memory(dst: &[mut u8], src: &[const u8], count: uint) {
2205+
=======
2206+
pub fn copy_memory(dst: &mut [u8], src: &[const u8], count: uint) {
2207+
>>>>>>> RIMOV, round 5
22042208
// Bound checks are done at vec::raw::copy_memory.
22052209
unsafe { vec::raw::copy_memory(dst, src, count) }
22062210
}

src/librustc/middle/trans/cabi_x86_64.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
127127
}
128128
}
129129

130-
fn all_mem(cls: &[mut x86_64_reg_class]) {
130+
fn all_mem(cls: &mut [x86_64_reg_class]) {
131131
for uint::range(0, cls.len()) |i| {
132132
cls[i] = memory_class;
133133
}
134134
}
135135

136-
fn unify(cls: &[mut x86_64_reg_class],
136+
fn unify(cls: &mut [x86_64_reg_class],
137137
i: uint,
138138
newv: x86_64_reg_class) {
139139
if cls[i] == newv {
@@ -159,7 +159,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
159159
}
160160

161161
fn classify_struct(tys: &[TypeRef],
162-
cls: &[mut x86_64_reg_class], i: uint,
162+
cls: &mut [x86_64_reg_class], i: uint,
163163
off: uint) {
164164
let mut field_off = off;
165165
for vec::each(tys) |ty| {
@@ -170,7 +170,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
170170
}
171171

172172
fn classify(ty: TypeRef,
173-
cls: &[mut x86_64_reg_class], ix: uint,
173+
cls: &mut [x86_64_reg_class], ix: uint,
174174
off: uint) {
175175
unsafe {
176176
let t_align = ty_align(ty);
@@ -220,7 +220,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
220220
}
221221
}
222222

223-
fn fixup(ty: TypeRef, cls: &[mut x86_64_reg_class]) {
223+
fn fixup(ty: TypeRef, cls: &mut [x86_64_reg_class]) {
224224
unsafe {
225225
let mut i = 0u;
226226
let llty = llvm::LLVMGetTypeKind(ty) as int;

src/librustc/middle/typeck/check/method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ pub impl LookupContext {
778778
/*!
779779
*
780780
* In the event that we are invoking a method with a receiver
781-
* of a linear borrowed type like `&mut T` or `&[mut T]`,
781+
* of a linear borrowed type like `&mut T` or `&mut [T]`,
782782
* we will "reborrow" the receiver implicitly. For example, if
783783
* you have a call `r.inc()` and where `r` has type `&mut T`,
784784
* then we treat that like `(&mut *r).inc()`. This avoids

src/libstd/io_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub impl BufReader {
4343
}
4444

4545
impl BufReader: Reader {
46-
fn read(&self, bytes: &[mut u8], len: uint) -> uint {
46+
fn read(&self, bytes: &mut [u8], len: uint) -> uint {
4747
self.as_bytes_reader(|r| r.read(bytes, len) )
4848
}
4949
fn read_byte(&self) -> int {

src/libstd/net_tcp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ impl TcpSocket {
863863

864864
/// Implementation of `io::reader` trait for a buffered `net::tcp::tcp_socket`
865865
impl TcpSocketBuf: io::Reader {
866-
fn read(&self, buf: &[mut u8], len: uint) -> uint {
866+
fn read(&self, buf: &mut [u8], len: uint) -> uint {
867867
if len == 0 { return 0 }
868868
let mut count: uint = 0;
869869

src/libstd/rope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ pub mod node {
788788
* * forest - The forest. This vector is progressively rewritten during
789789
* execution and should be discarded as meaningless afterwards.
790790
*/
791-
pub fn tree_from_forest_destructive(forest: &[mut @Node]) -> @Node {
791+
pub fn tree_from_forest_destructive(forest: &mut [@Node]) -> @Node {
792792
let mut i;
793793
let mut len = vec::len(forest);
794794
while len > 1u {

src/libstd/sort.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub pure fn merge_sort<T: Copy>(v: &[const T], le: Le<T>) -> ~[T] {
6464
}
6565
}
6666

67-
fn part<T: Copy>(arr: &[mut T], left: uint,
67+
fn part<T: Copy>(arr: &mut [T], left: uint,
6868
right: uint, pivot: uint, compare_func: Le<T>) -> uint {
6969
let pivot_value = arr[pivot];
7070
arr[pivot] <-> arr[right];
@@ -81,7 +81,7 @@ fn part<T: Copy>(arr: &[mut T], left: uint,
8181
return storage_index;
8282
}
8383

84-
fn qsort<T: Copy>(arr: &[mut T], left: uint,
84+
fn qsort<T: Copy>(arr: &mut [T], left: uint,
8585
right: uint, compare_func: Le<T>) {
8686
if right > left {
8787
let pivot = (left + right) / 2u;
@@ -100,12 +100,12 @@ fn qsort<T: Copy>(arr: &[mut T], left: uint,
100100
* Has worst case O(n^2) performance, average case O(n log n).
101101
* This is an unstable sort.
102102
*/
103-
pub fn quick_sort<T: Copy>(arr: &[mut T], compare_func: Le<T>) {
103+
pub fn quick_sort<T: Copy>(arr: &mut [T], compare_func: Le<T>) {
104104
if len::<T>(arr) == 0u { return; }
105105
qsort::<T>(arr, 0u, len::<T>(arr) - 1u, compare_func);
106106
}
107107

108-
fn qsort3<T: Copy Ord Eq>(arr: &[mut T], left: int, right: int) {
108+
fn qsort3<T: Copy Ord Eq>(arr: &mut [T], left: int, right: int) {
109109
if right <= left { return; }
110110
let v: T = arr[right];
111111
let mut i: int = left - 1;
@@ -162,7 +162,7 @@ fn qsort3<T: Copy Ord Eq>(arr: &[mut T], left: int, right: int) {
162162
*
163163
* This is an unstable sort.
164164
*/
165-
pub fn quick_sort3<T: Copy Ord Eq>(arr: &[mut T]) {
165+
pub fn quick_sort3<T: Copy Ord Eq>(arr: &mut [T]) {
166166
if arr.len() <= 1 { return; }
167167
qsort3(arr, 0, (arr.len() - 1) as int);
168168
}
@@ -171,15 +171,15 @@ pub trait Sort {
171171
fn qsort(self);
172172
}
173173

174-
impl<T: Copy Ord Eq> &[mut T] : Sort {
174+
impl<T: Copy Ord Eq> &mut [T] : Sort {
175175
fn qsort(self) { quick_sort3(self); }
176176
}
177177

178178
const MIN_MERGE: uint = 64;
179179
const MIN_GALLOP: uint = 7;
180180
const INITIAL_TMP_STORAGE: uint = 128;
181181

182-
pub fn tim_sort<T: Copy Ord>(array: &[mut T]) {
182+
pub fn tim_sort<T: Copy Ord>(array: &mut [T]) {
183183
let size = array.len();
184184
if size < 2 {
185185
return;
@@ -218,7 +218,7 @@ pub fn tim_sort<T: Copy Ord>(array: &[mut T]) {
218218
ms.merge_force_collapse(array);
219219
}
220220

221-
fn binarysort<T: Copy Ord>(array: &[mut T], start: uint) {
221+
fn binarysort<T: Copy Ord>(array: &mut [T], start: uint) {
222222
let size = array.len();
223223
let mut start = start;
224224
assert start <= size;
@@ -249,7 +249,7 @@ fn binarysort<T: Copy Ord>(array: &[mut T], start: uint) {
249249
}
250250

251251
// Reverse the order of elements in a slice, in place
252-
fn reverse_slice<T>(v: &[mut T], start: uint, end:uint) {
252+
fn reverse_slice<T>(v: &mut [T], start: uint, end:uint) {
253253
let mut i = start;
254254
while i < end / 2 {
255255
util::swap(&mut v[i], &mut v[end - i - 1]);
@@ -268,7 +268,7 @@ pure fn min_run_length(n: uint) -> uint {
268268
return n + r;
269269
}
270270

271-
fn count_run_ascending<T: Copy Ord>(array: &[mut T]) -> uint {
271+
fn count_run_ascending<T: Copy Ord>(array: &mut [T]) -> uint {
272272
let size = array.len();
273273
assert size > 0;
274274
if size == 1 { return 1; }
@@ -412,7 +412,7 @@ impl<T: Copy Ord> MergeState<T> {
412412
self.runs.push(tmp);
413413
}
414414

415-
fn merge_at(&self, n: uint, array: &[mut T]) {
415+
fn merge_at(&self, n: uint, array: &mut [T]) {
416416
let mut size = self.runs.len();
417417
assert size >= 2;
418418
assert n == size-2 || n == size-3;
@@ -453,7 +453,7 @@ impl<T: Copy Ord> MergeState<T> {
453453
self.runs.pop();
454454
}
455455

456-
fn merge_lo(&self, array: &[mut T], base1: uint, len1: uint,
456+
fn merge_lo(&self, array: &mut [T], base1: uint, len1: uint,
457457
base2: uint, len2: uint) {
458458
assert len1 != 0 && len2 != 0 && base1+len1 == base2;
459459

@@ -556,7 +556,7 @@ impl<T: Copy Ord> MergeState<T> {
556556
}
557557
}
558558
559-
fn merge_hi(&self, array: &[mut T], base1: uint, len1: uint,
559+
fn merge_hi(&self, array: &mut [T], base1: uint, len1: uint,
560560
base2: uint, len2: uint) {
561561
assert len1 != 1 && len2 != 0 && base1 + len1 == base2;
562562
@@ -674,7 +674,7 @@ impl<T: Copy Ord> MergeState<T> {
674674
}
675675
}
676676

677-
fn merge_collapse(&self, array: &[mut T]) {
677+
fn merge_collapse(&self, array: &mut [T]) {
678678
while self.runs.len() > 1 {
679679
let mut n = self.runs.len()-2;
680680
let chk = do self.runs.borrow |arr| {
@@ -692,7 +692,7 @@ impl<T: Copy Ord> MergeState<T> {
692692
}
693693
}
694694

695-
fn merge_force_collapse(&self, array: &[mut T]) {
695+
fn merge_force_collapse(&self, array: &mut [T]) {
696696
while self.runs.len() > 1 {
697697
let mut n = self.runs.len()-2;
698698
if n > 0 {
@@ -708,7 +708,7 @@ impl<T: Copy Ord> MergeState<T> {
708708
}
709709

710710
#[inline(always)]
711-
fn copy_vec<T: Copy>(dest: &[mut T], s1: uint,
711+
fn copy_vec<T: Copy>(dest: &mut [T], s1: uint,
712712
from: &[const T], s2: uint, len: uint) {
713713
assert s1+len <= dest.len() && s2+len <= from.len();
714714

@@ -726,7 +726,7 @@ mod test_qsort3 {
726726

727727
use core::vec;
728728

729-
pub fn check_sort(v1: &[mut int], v2: &[mut int]) {
729+
pub fn check_sort(v1: &mut [int], v2: &mut [int]) {
730730
let len = vec::len::<int>(v1);
731731
quick_sort3::<int>(v1);
732732
let mut i = 0;
@@ -772,7 +772,7 @@ mod test_qsort {
772772
use core::int;
773773
use core::vec;
774774

775-
pub fn check_sort(v1: &[mut int], v2: &[mut int]) {
775+
pub fn check_sort(v1: &mut [int], v2: &mut [int]) {
776776
let len = vec::len::<int>(v1);
777777
pure fn leual(a: &int, b: &int) -> bool { *a <= *b }
778778
quick_sort::<int>(v1, leual);
@@ -923,7 +923,7 @@ mod test_tim_sort {
923923
pure fn ge(&self, other: &CVal) -> bool { (*self).val >= other.val }
924924
}
925925

926-
fn check_sort(v1: &[mut int], v2: &[mut int]) {
926+
fn check_sort(v1: &mut [int], v2: &mut [int]) {
927927
let len = vec::len::<int>(v1);
928928
tim_sort::<int>(v1);
929929
let mut i = 0u;

0 commit comments

Comments
 (0)