diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index b3c83ba55598b..9b5cf4ce4d138 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -246,11 +246,11 @@ impl String { /// // 𝄞music /// let mut v = [0xD834, 0xDD1E, 0x006d, 0x0075, /// 0x0073, 0x0069, 0x0063]; - /// assert_eq!(String::from_utf16(v), Some("𝄞music".to_string())); + /// assert_eq!(String::from_utf16(&v), Some("𝄞music".to_string())); /// /// // 𝄞muic /// v[4] = 0xD800; - /// assert_eq!(String::from_utf16(v), None); + /// assert_eq!(String::from_utf16(&v), None); /// ``` #[unstable = "error value in return may change"] pub fn from_utf16(v: &[u16]) -> Option { @@ -274,7 +274,7 @@ impl String { /// 0x0073, 0xDD1E, 0x0069, 0x0063, /// 0xD834]; /// - /// assert_eq!(String::from_utf16_lossy(v), + /// assert_eq!(String::from_utf16_lossy(&v), /// "𝄞mus\uFFFDic\uFFFD".to_string()); /// ``` #[stable] @@ -288,7 +288,7 @@ impl String { /// /// ```rust /// let chars = ['h', 'e', 'l', 'l', 'o']; - /// let s = String::from_chars(chars); + /// let s = String::from_chars(&chars); /// assert_eq!(s.as_slice(), "hello"); /// ``` #[inline] @@ -592,7 +592,7 @@ impl String { assert!(self.as_slice().is_char_boundary(idx)); self.vec.reserve_additional(4); let mut bits = [0, ..4]; - let amt = ch.encode_utf8(bits).unwrap(); + let amt = ch.encode_utf8(&mut bits).unwrap(); unsafe { ptr::copy_memory(self.vec.as_mut_ptr().offset((idx + amt) as int), @@ -981,30 +981,30 @@ mod tests { fn test_utf16_invalid() { // completely positive cases tested above. // lead + eof - assert_eq!(String::from_utf16([0xD800]), None); + assert_eq!(String::from_utf16(&[0xD800]), None); // lead + lead - assert_eq!(String::from_utf16([0xD800, 0xD800]), None); + assert_eq!(String::from_utf16(&[0xD800, 0xD800]), None); // isolated trail - assert_eq!(String::from_utf16([0x0061, 0xDC00]), None); + assert_eq!(String::from_utf16(&[0x0061, 0xDC00]), None); // general - assert_eq!(String::from_utf16([0xD800, 0xd801, 0xdc8b, 0xD800]), None); + assert_eq!(String::from_utf16(&[0xD800, 0xd801, 0xdc8b, 0xD800]), None); } #[test] fn test_from_utf16_lossy() { // completely positive cases tested above. // lead + eof - assert_eq!(String::from_utf16_lossy([0xD800]), String::from_str("\uFFFD")); + assert_eq!(String::from_utf16_lossy(&[0xD800]), String::from_str("\uFFFD")); // lead + lead - assert_eq!(String::from_utf16_lossy([0xD800, 0xD800]), String::from_str("\uFFFD\uFFFD")); + assert_eq!(String::from_utf16_lossy(&[0xD800, 0xD800]), String::from_str("\uFFFD\uFFFD")); // isolated trail - assert_eq!(String::from_utf16_lossy([0x0061, 0xDC00]), String::from_str("a\uFFFD")); + assert_eq!(String::from_utf16_lossy(&[0x0061, 0xDC00]), String::from_str("a\uFFFD")); // general - assert_eq!(String::from_utf16_lossy([0xD800, 0xd801, 0xdc8b, 0xD800]), + assert_eq!(String::from_utf16_lossy(&[0xD800, 0xd801, 0xdc8b, 0xD800]), String::from_str("\uFFFD𐒋\uFFFD")); } @@ -1031,7 +1031,7 @@ mod tests { let mut s = String::from_str("ABC"); unsafe { let mv = s.as_mut_vec(); - mv.push_all([b'D']); + mv.push_all(&[b'D']); } assert_eq!(s.as_slice(), "ABCD"); } diff --git a/src/libcollections/tree/set.rs b/src/libcollections/tree/set.rs index d24a8234b20b8..affc2e41ca5ab 100644 --- a/src/libcollections/tree/set.rs +++ b/src/libcollections/tree/set.rs @@ -840,14 +840,14 @@ mod test { check(a, b, expected, |x, y, f| x.intersection(y).all(f)) } - check_intersection([], [], []); - check_intersection([1, 2, 3], [], []); - check_intersection([], [1, 2, 3], []); - check_intersection([2], [1, 2, 3], [2]); - check_intersection([1, 2, 3], [2], [2]); - check_intersection([11, 1, 3, 77, 103, 5, -5], - [2, 11, 77, -9, -42, 5, 3], - [3, 5, 11, 77]); + check_intersection(&[], &[], &[]); + check_intersection(&[1, 2, 3], &[], &[]); + check_intersection(&[], &[1, 2, 3], &[]); + check_intersection(&[2], &[1, 2, 3], &[2]); + check_intersection(&[1, 2, 3], &[2], &[2]); + check_intersection(&[11, 1, 3, 77, 103, 5, -5], + &[2, 11, 77, -9, -42, 5, 3], + &[3, 5, 11, 77]); } #[test] @@ -856,15 +856,15 @@ mod test { check(a, b, expected, |x, y, f| x.difference(y).all(f)) } - check_difference([], [], []); - check_difference([1, 12], [], [1, 12]); - check_difference([], [1, 2, 3, 9], []); - check_difference([1, 3, 5, 9, 11], - [3, 9], - [1, 5, 11]); - check_difference([-5, 11, 22, 33, 40, 42], - [-12, -5, 14, 23, 34, 38, 39, 50], - [11, 22, 33, 40, 42]); + check_difference(&[], &[], &[]); + check_difference(&[1, 12], &[], &[1, 12]); + check_difference(&[], &[1, 2, 3, 9], &[]); + check_difference(&[1, 3, 5, 9, 11], + &[3, 9], + &[1, 5, 11]); + check_difference(&[-5, 11, 22, 33, 40, 42], + &[-12, -5, 14, 23, 34, 38, 39, 50], + &[11, 22, 33, 40, 42]); } #[test] @@ -874,12 +874,12 @@ mod test { check(a, b, expected, |x, y, f| x.symmetric_difference(y).all(f)) } - check_symmetric_difference([], [], []); - check_symmetric_difference([1, 2, 3], [2], [1, 3]); - check_symmetric_difference([2], [1, 2, 3], [1, 3]); - check_symmetric_difference([1, 3, 5, 9, 11], - [-2, 3, 9, 14, 22], - [-2, 1, 5, 11, 14, 22]); + check_symmetric_difference(&[], &[], &[]); + check_symmetric_difference(&[1, 2, 3], &[2], &[1, 3]); + check_symmetric_difference(&[2], &[1, 2, 3], &[1, 3]); + check_symmetric_difference(&[1, 3, 5, 9, 11], + &[-2, 3, 9, 14, 22], + &[-2, 1, 5, 11, 14, 22]); } #[test] @@ -889,12 +889,12 @@ mod test { check(a, b, expected, |x, y, f| x.union(y).all(f)) } - check_union([], [], []); - check_union([1, 2, 3], [2], [1, 2, 3]); - check_union([2], [1, 2, 3], [1, 2, 3]); - check_union([1, 3, 5, 9, 11, 16, 19, 24], - [-2, 1, 5, 9, 13, 19], - [-2, 1, 3, 5, 9, 11, 13, 16, 19, 24]); + check_union(&[], &[], &[]); + check_union(&[1, 2, 3], &[2], &[1, 2, 3]); + check_union(&[2], &[1, 2, 3], &[1, 2, 3]); + check_union(&[1, 3, 5, 9, 11, 16, 19, 24], + &[-2, 1, 5, 9, 13, 19], + &[-2, 1, 3, 5, 9, 11, 13, 16, 19, 24]); } #[test] diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 40e7c949972b5..4fc71d4adf525 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -47,7 +47,7 @@ use slice::{CloneableVector}; /// vec[0] = 7i; /// assert_eq!(vec[0], 7); /// -/// vec.push_all([1, 2, 3]); +/// vec.push_all(&[1, 2, 3]); /// /// for x in vec.iter() { /// println!("{}", x); @@ -306,7 +306,7 @@ impl Vec { /// /// ``` /// let mut vec = vec![1i]; - /// vec.push_all([2i, 3, 4]); + /// vec.push_all(&[2i, 3, 4]); /// assert_eq!(vec, vec![1, 2, 3, 4]); /// ``` #[inline] @@ -643,7 +643,7 @@ impl Vec { /// /// ``` /// let mut vec: Vec = Vec::with_capacity(10); - /// vec.push_all([1, 2, 3]); + /// vec.push_all(&[1, 2, 3]); /// assert_eq!(vec.capacity(), 10); /// vec.shrink_to_fit(); /// assert!(vec.capacity() >= 3); @@ -1680,7 +1680,7 @@ mod tests { #[test] fn test_as_vec() { let xs = [1u8, 2u8, 3u8]; - assert_eq!(as_vec(xs).as_slice(), xs.as_slice()); + assert_eq!(as_vec(&xs).as_slice(), xs.as_slice()); } #[test] @@ -1770,13 +1770,13 @@ mod tests { let mut values = vec![1u8,2,3,4,5]; { let slice = values.slice_from_mut(2); - assert!(slice == [3, 4, 5]); + assert!(slice == &mut [3, 4, 5]); for p in slice.iter_mut() { *p += 2; } } - assert!(values.as_slice() == [1, 2, 5, 6, 7]); + assert!(values.as_slice() == &[1, 2, 5, 6, 7]); } #[test] @@ -1784,13 +1784,13 @@ mod tests { let mut values = vec![1u8,2,3,4,5]; { let slice = values.slice_to_mut(2); - assert!(slice == [1, 2]); + assert!(slice == &mut [1, 2]); for p in slice.iter_mut() { *p += 1; } } - assert!(values.as_slice() == [2, 3, 3, 4, 5]); + assert!(values.as_slice() == &[2, 3, 3, 4, 5]); } #[test] diff --git a/src/libcore/finally.rs b/src/libcore/finally.rs index a17169f62c8be..2e358e7a74b64 100644 --- a/src/libcore/finally.rs +++ b/src/libcore/finally.rs @@ -79,7 +79,7 @@ impl Finally for fn() -> T { * * struct State<'a> { buffer: &'a mut [u8], len: uint } * # let mut buf = []; - * let mut state = State { buffer: buf, len: 0 }; + * let mut state = State { buffer: &mut buf, len: 0 }; * try_finally( * &mut state, (), * |state, ()| { diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index f51d3948757c7..94f2d8bc0a106 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -315,7 +315,7 @@ pub fn float_to_str_bytes_common( } } - let mut filler = Filler { buf: buf, end: &mut end }; + let mut filler = Filler { buf: &mut buf, end: &mut end }; match sign { SignNeg => { let _ = format_args!(|args| { diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 013ed999b032b..1176192b9d317 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -392,7 +392,7 @@ impl<'a> Formatter<'a> { let write_prefix = |f: &mut Formatter| { for c in sign.into_iter() { let mut b = [0, ..4]; - let n = c.encode_utf8(b).unwrap_or(0); + let n = c.encode_utf8(&mut b).unwrap_or(0); try!(f.buf.write(b[..n])); } if prefixed { f.buf.write(prefix.as_bytes()) } @@ -497,7 +497,7 @@ impl<'a> Formatter<'a> { }; let mut fill = [0u8, ..4]; - let len = self.fill.encode_utf8(fill).unwrap_or(0); + let len = self.fill.encode_utf8(&mut fill).unwrap_or(0); for _ in range(0, pre_pad) { try!(self.buf.write(fill[..len])); @@ -586,7 +586,7 @@ impl Char for char { use char::Char; let mut utf8 = [0u8, ..4]; - let amt = self.encode_utf8(utf8).unwrap_or(0); + let amt = self.encode_utf8(&mut utf8).unwrap_or(0); let s: &str = unsafe { mem::transmute(utf8[..amt]) }; String::fmt(s, f) } diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 91f95ef203c12..e8234c4b24cd5 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -228,7 +228,7 @@ extern "rust-intrinsic" { /// use std::mem; /// /// let v: &[u8] = unsafe { mem::transmute("L") }; - /// assert!(v == [76u8]); + /// assert!(v == &[76u8]); /// ``` pub fn transmute(e: T) -> U; diff --git a/src/libcore/option.rs b/src/libcore/option.rs index b787de4423aac..83425ec911674 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -264,9 +264,9 @@ impl Option { /// let mut x = Some("Diamonds"); /// { /// let v = x.as_mut_slice(); - /// assert!(v == ["Diamonds"]); + /// assert!(v == &mut ["Diamonds"]); /// v[0] = "Dirt"; - /// assert!(v == ["Dirt"]); + /// assert!(v == &mut ["Dirt"]); /// } /// assert_eq!(x, Some("Dirt")); /// ``` diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 2ad5521bb76cd..0c8b2404599c4 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -452,14 +452,14 @@ impl Result { /// let mut x: Result<&str, uint> = Ok("Gold"); /// { /// let v = x.as_mut_slice(); - /// assert!(v == ["Gold"]); + /// assert!(v == &mut ["Gold"]); /// v[0] = "Silver"; - /// assert!(v == ["Silver"]); + /// assert!(v == &mut ["Silver"]); /// } /// assert_eq!(x, Ok("Silver")); /// /// let mut x: Result<&str, uint> = Err(45); - /// assert!(x.as_mut_slice() == []); + /// assert!(x.as_mut_slice() == &mut []); /// ``` #[inline] #[unstable = "waiting for mut conventions"] diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 317a6e224bce9..3c57090f2c81a 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -558,7 +558,7 @@ pub trait MutableSlice for Sized? { /// ```rust /// let mut v = ["a", "b", "c", "d"]; /// v.swap(1, 3); - /// assert!(v == ["a", "d", "c", "b"]); + /// assert!(v == &["a", "d", "c", "b"]); /// ``` #[unstable = "waiting on final error conventions"] fn swap(&mut self, a: uint, b: uint); @@ -605,7 +605,7 @@ pub trait MutableSlice for Sized? { /// ```rust /// let mut v = [1i, 2, 3]; /// v.reverse(); - /// assert!(v == [3i, 2, 1]); + /// assert!(v == &[3i, 2, 1]); /// ``` #[experimental = "may be moved to iterators instead"] fn reverse(&mut self); @@ -867,12 +867,12 @@ pub trait MutableCloneableSlice for Sized? { /// let mut dst = [0i, 0, 0]; /// let src = [1i, 2]; /// - /// assert!(dst.clone_from_slice(src) == 2); - /// assert!(dst == [1, 2, 0]); + /// assert!(dst.clone_from_slice(&src) == 2); + /// assert!(dst == &[1, 2, 0]); /// /// let src2 = [3i, 4, 5, 6]; - /// assert!(dst.clone_from_slice(src2) == 3); - /// assert!(dst == [3i, 4, 5]); + /// assert!(dst.clone_from_slice(&src2) == 3); + /// assert!(dst == &[3i, 4, 5]); /// ``` fn clone_from_slice(&mut self, &[T]) -> uint; } diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 8937f2a946a85..2f49fd593b674 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -974,7 +974,7 @@ impl<'a> Iterator for Utf16Items<'a> { /// 0x0073, 0xDD1E, 0x0069, 0x0063, /// 0xD834]; /// -/// assert_eq!(str::utf16_items(v).collect::>(), +/// assert_eq!(str::utf16_items(&v).collect::>(), /// vec![ScalarValue('𝄞'), /// ScalarValue('m'), ScalarValue('u'), ScalarValue('s'), /// LoneSurrogate(0xDD1E), @@ -996,12 +996,12 @@ pub fn utf16_items<'a>(v: &'a [u16]) -> Utf16Items<'a> { /// // "abcd" /// let mut v = ['a' as u16, 'b' as u16, 'c' as u16, 'd' as u16]; /// // no NULs so no change -/// assert_eq!(str::truncate_utf16_at_nul(v), v.as_slice()); +/// assert_eq!(str::truncate_utf16_at_nul(&v), v.as_slice()); /// /// // "ab\0d" /// v[2] = 0; /// let b: &[_] = &['a' as u16, 'b' as u16]; -/// assert_eq!(str::truncate_utf16_at_nul(v), b); +/// assert_eq!(str::truncate_utf16_at_nul(&v), b); /// ``` pub fn truncate_utf16_at_nul<'a>(v: &'a [u16]) -> &'a [u16] { match v.iter().position(|c| *c == 0) { diff --git a/src/libcoretest/char.rs b/src/libcoretest/char.rs index 50a2e47cafaba..8ec3c59da4e00 100644 --- a/src/libcoretest/char.rs +++ b/src/libcoretest/char.rs @@ -177,10 +177,10 @@ fn test_encode_utf8() { assert_eq!(buf[..n], expect); } - check('x', [0x78]); - check('\u00e9', [0xc3, 0xa9]); - check('\ua66e', [0xea, 0x99, 0xae]); - check('\U0001f4a9', [0xf0, 0x9f, 0x92, 0xa9]); + check('x', &[0x78]); + check('\u00e9', &[0xc3, 0xa9]); + check('\ua66e', &[0xea, 0x99, 0xae]); + check('\U0001f4a9', &[0xf0, 0x9f, 0x92, 0xa9]); } #[test] @@ -191,10 +191,10 @@ fn test_encode_utf16() { assert_eq!(buf[..n], expect); } - check('x', [0x0078]); - check('\u00e9', [0x00e9]); - check('\ua66e', [0xa66e]); - check('\U0001f4a9', [0xd83d, 0xdca9]); + check('x', &[0x0078]); + check('\u00e9', &[0x00e9]); + check('\ua66e', &[0xa66e]); + check('\U0001f4a9', &[0xd83d, 0xdca9]); } #[test] diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index aeab18ca05e30..e013aace9b89c 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -627,7 +627,7 @@ fn test_random_access_zip() { #[test] fn test_random_access_take() { let xs = [1i, 2, 3, 4, 5]; - let empty: &[int] = []; + let empty: &[int] = &[]; check_randacc_iter(xs.iter().take(3), 3); check_randacc_iter(xs.iter().take(20), xs.len()); check_randacc_iter(xs.iter().take(0), 0); @@ -637,7 +637,7 @@ fn test_random_access_take() { #[test] fn test_random_access_skip() { let xs = [1i, 2, 3, 4, 5]; - let empty: &[int] = []; + let empty: &[int] = &[]; check_randacc_iter(xs.iter().skip(2), xs.len() - 2); check_randacc_iter(empty.iter().skip(2), 0); } @@ -669,7 +669,7 @@ fn test_random_access_map() { #[test] fn test_random_access_cycle() { let xs = [1i, 2, 3, 4, 5]; - let empty: &[int] = []; + let empty: &[int] = &[]; check_randacc_iter(xs.iter().cycle().take(27), 27); check_randacc_iter(empty.iter().cycle(), 0); } @@ -795,7 +795,7 @@ fn test_range_step_inclusive() { fn test_reverse() { let mut ys = [1i, 2, 3, 4, 5]; ys.iter_mut().reverse_(); - assert!(ys == [5, 4, 3, 2, 1]); + assert!(ys == &[5, 4, 3, 2, 1]); } #[test] diff --git a/src/libcoretest/ptr.rs b/src/libcoretest/ptr.rs index db3580e5d0c42..0b4e6aff40360 100644 --- a/src/libcoretest/ptr.rs +++ b/src/libcoretest/ptr.rs @@ -168,5 +168,5 @@ fn test_set_memory() { let mut xs = [0u8, ..20]; let ptr = xs.as_mut_ptr(); unsafe { set_memory(ptr, 5u8, xs.len()); } - assert!(xs == [5u8, ..20]); + assert!(xs == &[5u8, ..20]); } diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index a9f34e1195ce6..2dd9d00ca1f23 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -454,12 +454,12 @@ mod tests { #[test] fn simple() { - same("asdf", [String("asdf")]); - same("a{{b", [String("a"), String("{b")]); - same("a}}b", [String("a"), String("}b")]); - same("a}}", [String("a"), String("}")]); - same("}}", [String("}")]); - same("\\}}", [String("\\"), String("}")]); + same("asdf", &[String("asdf")]); + same("a{{b", &[String("a"), String("{b")]); + same("a}}b", &[String("a"), String("}b")]); + same("a}}", &[String("a"), String("}")]); + same("}}", &[String("}")]); + same("\\}}", &[String("\\"), String("}")]); } #[test] fn invalid01() { musterr("{") } @@ -470,28 +470,28 @@ mod tests { #[test] fn format_nothing() { - same("{}", [NextArgument(Argument { + same("{}", &[NextArgument(Argument { position: ArgumentNext, format: fmtdflt(), })]); } #[test] fn format_position() { - same("{3}", [NextArgument(Argument { + same("{3}", &[NextArgument(Argument { position: ArgumentIs(3), format: fmtdflt(), })]); } #[test] fn format_position_nothing_else() { - same("{3:}", [NextArgument(Argument { + same("{3:}", &[NextArgument(Argument { position: ArgumentIs(3), format: fmtdflt(), })]); } #[test] fn format_type() { - same("{3:a}", [NextArgument(Argument { + same("{3:a}", &[NextArgument(Argument { position: ArgumentIs(3), format: FormatSpec { fill: None, @@ -505,7 +505,7 @@ mod tests { } #[test] fn format_align_fill() { - same("{3:>}", [NextArgument(Argument { + same("{3:>}", &[NextArgument(Argument { position: ArgumentIs(3), format: FormatSpec { fill: None, @@ -516,7 +516,7 @@ mod tests { ty: "", }, })]); - same("{3:0<}", [NextArgument(Argument { + same("{3:0<}", &[NextArgument(Argument { position: ArgumentIs(3), format: FormatSpec { fill: Some('0'), @@ -527,7 +527,7 @@ mod tests { ty: "", }, })]); - same("{3:* { m } //! Err(f) => { panic!(f.to_string()) } //! }; //! if matches.opt_present("h") { -//! print_usage(program.as_slice(), opts); +//! print_usage(program.as_slice(), &opts); //! return; //! } //! let output = matches.opt_str("o"); //! let input = if !matches.free.is_empty() { //! matches.free[0].clone() //! } else { -//! print_usage(program.as_slice(), opts); +//! print_usage(program.as_slice(), &opts); //! return; //! }; //! do_work(input.as_slice(), output); @@ -943,16 +943,16 @@ fn test_split_within() { each_split_within(s, i, |s| { v.push(s.to_string()); true }); assert!(v.iter().zip(u.iter()).all(|(a,b)| a == b)); } - t("", 0, []); - t("", 15, []); - t("hello", 15, ["hello".to_string()]); - t("\nMary had a little lamb\nLittle lamb\n", 15, [ + t("", 0, &[]); + t("", 15, &[]); + t("hello", 15, &["hello".to_string()]); + t("\nMary had a little lamb\nLittle lamb\n", 15, &[ "Mary had a".to_string(), "little lamb".to_string(), "Little lamb".to_string() ]); t("\nMary had a little lamb\nLittle lamb\n", ::std::uint::MAX, - ["Mary had a little lamb\nLittle lamb".to_string()]); + &["Mary had a little lamb\nLittle lamb".to_string()]); } #[cfg(test)] @@ -1415,17 +1415,17 @@ mod tests { result::Ok(m) => m, result::Err(_) => panic!() }; - assert!(matches_single.opts_present(["e".to_string()])); - assert!(matches_single.opts_present(["encrypt".to_string(), "e".to_string()])); - assert!(matches_single.opts_present(["e".to_string(), "encrypt".to_string()])); - assert!(!matches_single.opts_present(["encrypt".to_string()])); - assert!(!matches_single.opts_present(["thing".to_string()])); - assert!(!matches_single.opts_present([])); - - assert_eq!(matches_single.opts_str(["e".to_string()]).unwrap(), "foo".to_string()); - assert_eq!(matches_single.opts_str(["e".to_string(), "encrypt".to_string()]).unwrap(), + assert!(matches_single.opts_present(&["e".to_string()])); + assert!(matches_single.opts_present(&["encrypt".to_string(), "e".to_string()])); + assert!(matches_single.opts_present(&["e".to_string(), "encrypt".to_string()])); + assert!(!matches_single.opts_present(&["encrypt".to_string()])); + assert!(!matches_single.opts_present(&["thing".to_string()])); + assert!(!matches_single.opts_present(&[])); + + assert_eq!(matches_single.opts_str(&["e".to_string()]).unwrap(), "foo".to_string()); + assert_eq!(matches_single.opts_str(&["e".to_string(), "encrypt".to_string()]).unwrap(), "foo".to_string()); - assert_eq!(matches_single.opts_str(["encrypt".to_string(), "e".to_string()]).unwrap(), + assert_eq!(matches_single.opts_str(&["encrypt".to_string(), "e".to_string()]).unwrap(), "foo".to_string()); let args_both = vec!("-e".to_string(), "foo".to_string(), "--encrypt".to_string(), @@ -1435,19 +1435,19 @@ mod tests { result::Ok(m) => m, result::Err(_) => panic!() }; - assert!(matches_both.opts_present(["e".to_string()])); - assert!(matches_both.opts_present(["encrypt".to_string()])); - assert!(matches_both.opts_present(["encrypt".to_string(), "e".to_string()])); - assert!(matches_both.opts_present(["e".to_string(), "encrypt".to_string()])); - assert!(!matches_both.opts_present(["f".to_string()])); - assert!(!matches_both.opts_present(["thing".to_string()])); - assert!(!matches_both.opts_present([])); - - assert_eq!(matches_both.opts_str(["e".to_string()]).unwrap(), "foo".to_string()); - assert_eq!(matches_both.opts_str(["encrypt".to_string()]).unwrap(), "foo".to_string()); - assert_eq!(matches_both.opts_str(["e".to_string(), "encrypt".to_string()]).unwrap(), + assert!(matches_both.opts_present(&["e".to_string()])); + assert!(matches_both.opts_present(&["encrypt".to_string()])); + assert!(matches_both.opts_present(&["encrypt".to_string(), "e".to_string()])); + assert!(matches_both.opts_present(&["e".to_string(), "encrypt".to_string()])); + assert!(!matches_both.opts_present(&["f".to_string()])); + assert!(!matches_both.opts_present(&["thing".to_string()])); + assert!(!matches_both.opts_present(&[])); + + assert_eq!(matches_both.opts_str(&["e".to_string()]).unwrap(), "foo".to_string()); + assert_eq!(matches_both.opts_str(&["encrypt".to_string()]).unwrap(), "foo".to_string()); + assert_eq!(matches_both.opts_str(&["e".to_string(), "encrypt".to_string()]).unwrap(), "foo".to_string()); - assert_eq!(matches_both.opts_str(["encrypt".to_string(), "e".to_string()]).unwrap(), + assert_eq!(matches_both.opts_str(&["encrypt".to_string(), "e".to_string()]).unwrap(), "foo".to_string()); } @@ -1460,10 +1460,10 @@ mod tests { result::Ok(m) => m, result::Err(_) => panic!() }; - assert!(matches.opts_present(["L".to_string()])); - assert_eq!(matches.opts_str(["L".to_string()]).unwrap(), "foo".to_string()); - assert!(matches.opts_present(["M".to_string()])); - assert_eq!(matches.opts_str(["M".to_string()]).unwrap(), ".".to_string()); + assert!(matches.opts_present(&["L".to_string()])); + assert_eq!(matches.opts_str(&["L".to_string()]).unwrap(), "foo".to_string()); + assert!(matches.opts_present(&["M".to_string()])); + assert_eq!(matches.opts_str(&["M".to_string()]).unwrap(), ".".to_string()); } @@ -1476,9 +1476,9 @@ mod tests { result::Ok(m) => m, result::Err(e) => panic!( "{}", e ) }; - assert!(matches.opts_present(["L".to_string()])); - assert_eq!(matches.opts_str(["L".to_string()]).unwrap(), "verbose".to_string()); - assert!(matches.opts_present(["v".to_string()])); + assert!(matches.opts_present(&["L".to_string()])); + assert_eq!(matches.opts_str(&["L".to_string()]).unwrap(), "verbose".to_string()); + assert!(matches.opts_present(&["v".to_string()])); assert_eq!(3, matches.opt_count("v")); } diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index e21186a5fc879..7035809640d4a 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -514,13 +514,13 @@ pub fn render<'a, N:'a, E:'a, G:Labeller<'a,N,E>+GraphWalk<'a,N,E>, W:Writer>( w.write_str(" ") } - try!(writeln(w, ["digraph ", g.graph_id().as_slice(), " {"])); + try!(writeln(w, &["digraph ", g.graph_id().as_slice(), " {"])); for n in g.nodes().iter() { try!(indent(w)); let id = g.node_id(n); let escaped = g.node_label(n).escape(); - try!(writeln(w, [id.as_slice(), - "[label=\"", escaped.as_slice(), "\"];"])); + try!(writeln(w, &[id.as_slice(), + "[label=\"", escaped.as_slice(), "\"];"])); } for e in g.edges().iter() { @@ -530,11 +530,11 @@ pub fn render<'a, N:'a, E:'a, G:Labeller<'a,N,E>+GraphWalk<'a,N,E>, W:Writer>( let target = g.target(e); let source_id = g.node_id(&source); let target_id = g.node_id(&target); - try!(writeln(w, [source_id.as_slice(), " -> ", target_id.as_slice(), - "[label=\"", escaped_label.as_slice(), "\"];"])); + try!(writeln(w, &[source_id.as_slice(), " -> ", target_id.as_slice(), + "[label=\"", escaped_label.as_slice(), "\"];"])); } - writeln(w, ["}"]) + writeln(w, &["}"]) } #[cfg(test)] diff --git a/src/libgreen/stack.rs b/src/libgreen/stack.rs index 7d6c82cb0c325..125f623c843df 100644 --- a/src/libgreen/stack.rs +++ b/src/libgreen/stack.rs @@ -44,7 +44,7 @@ impl Stack { // allocation failure, which would fail to spawn the task. But there's // not many sensible things to do on OOM. Failure seems fine (and is // what the old stack allocation did). - let stack = match MemoryMap::new(size, [MapReadable, MapWritable, + let stack = match MemoryMap::new(size, &[MapReadable, MapWritable, MapNonStandardFlags(STACK_FLAGS)]) { Ok(map) => map, Err(e) => panic!("mmap for stack of size {} failed: {}", size, e) diff --git a/src/libnative/io/file_unix.rs b/src/libnative/io/file_unix.rs index f616295c73d1b..f1985f1328c3d 100644 --- a/src/libnative/io/file_unix.rs +++ b/src/libnative/io/file_unix.rs @@ -516,7 +516,7 @@ mod tests { writer.inner_write(b"test").ok().unwrap(); let mut buf = [0u8, ..4]; - match reader.inner_read(buf) { + match reader.inner_read(&mut buf) { Ok(4) => { assert_eq!(buf[0], 't' as u8); assert_eq!(buf[1], 'e' as u8); @@ -526,8 +526,8 @@ mod tests { r => panic!("invalid read: {}", r), } - assert!(writer.inner_read(buf).is_err()); - assert!(reader.inner_write(buf).is_err()); + assert!(writer.inner_read(&mut buf).is_err()); + assert!(reader.inner_write(&buf).is_err()); } #[test] @@ -540,7 +540,7 @@ mod tests { file.write(b"test").ok().unwrap(); let mut buf = [0u8, ..4]; let _ = file.seek(0, SeekSet).ok().unwrap(); - match file.read(buf) { + match file.read(&mut buf) { Ok(4) => { assert_eq!(buf[0], 't' as u8); assert_eq!(buf[1], 'e' as u8); diff --git a/src/libnative/io/helper_thread.rs b/src/libnative/io/helper_thread.rs index d1368ad31f475..28867902ac0a7 100644 --- a/src/libnative/io/helper_thread.rs +++ b/src/libnative/io/helper_thread.rs @@ -155,7 +155,7 @@ mod imp { } pub fn signal(fd: libc::c_int) { - FileDesc::new(fd, false).inner_write([0]).ok().unwrap(); + FileDesc::new(fd, false).inner_write(&[0]).ok().unwrap(); } pub fn close(fd: libc::c_int) { diff --git a/src/libnative/io/net.rs b/src/libnative/io/net.rs index a4b97a3eb84ef..95d2799671d43 100644 --- a/src/libnative/io/net.rs +++ b/src/libnative/io/net.rs @@ -549,7 +549,7 @@ impl TcpAcceptor { -1 => return Err(os::last_error()), fd => return Ok(TcpStream::new(Inner::new(fd as sock_t))), } - try!(util::await([self.fd(), self.inner.reader.fd()], + try!(util::await(&[self.fd(), self.inner.reader.fd()], deadline, util::Readable)); } @@ -660,7 +660,7 @@ impl rtio::RtioTcpAcceptor for TcpAcceptor { fn close_accept(&mut self) -> IoResult<()> { self.inner.closed.store(true, atomic::SeqCst); let mut fd = FileDesc::new(self.inner.writer.fd(), false); - match fd.inner_write([0]) { + match fd.inner_write(&[0]) { Ok(..) => Ok(()), Err(..) if util::wouldblock() => Ok(()), Err(e) => Err(e), @@ -948,7 +948,7 @@ pub fn read(fd: sock_t, // With a timeout, first we wait for the socket to become // readable using select(), specifying the relevant timeout for // our previously set deadline. - try!(util::await([fd], deadline, util::Readable)); + try!(util::await(&[fd], deadline, util::Readable)); // At this point, we're still within the timeout, and we've // determined that the socket is readable (as returned by @@ -1000,7 +1000,7 @@ pub fn write(fd: sock_t, while written < buf.len() && (write_everything || written == 0) { // As with read(), first wait for the socket to be ready for // the I/O operation. - match util::await([fd], deadline, util::Writable) { + match util::await(&[fd], deadline, util::Writable) { Err(ref e) if e.code == libc::EOF as uint && written > 0 => { assert!(deadline.is_some()); return Err(util::short_write(written, "short write")) diff --git a/src/libnative/io/pipe_unix.rs b/src/libnative/io/pipe_unix.rs index 48f31615339a0..302d6aa54880a 100644 --- a/src/libnative/io/pipe_unix.rs +++ b/src/libnative/io/pipe_unix.rs @@ -292,8 +292,8 @@ impl UnixAcceptor { fd => return Ok(UnixStream::new(Arc::new(Inner::new(fd)))), } } - try!(util::await([self.fd(), self.inner.reader.fd()], - deadline, util::Readable)); + try!(util::await(&[self.fd(), self.inner.reader.fd()], + deadline, util::Readable)); } Err(util::eof()) @@ -319,7 +319,7 @@ impl rtio::RtioUnixAcceptor for UnixAcceptor { fn close_accept(&mut self) -> IoResult<()> { self.inner.closed.store(true, atomic::SeqCst); let mut fd = FileDesc::new(self.inner.writer.fd(), false); - match fd.inner_write([0]) { + match fd.inner_write(&[0]) { Ok(..) => Ok(()), Err(..) if util::wouldblock() => Ok(()), Err(e) => Err(e), diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs index fed4a46b9df7f..fae8cb3289d95 100644 --- a/src/libnative/io/process.rs +++ b/src/libnative/io/process.rs @@ -581,7 +581,7 @@ fn spawn_process_os(cfg: ProcessConfig, } else if pid > 0 { drop(output); let mut bytes = [0, ..4]; - return match input.inner_read(bytes) { + return match input.inner_read(&mut bytes) { Ok(4) => { let errno = (bytes[0] as i32 << 24) | (bytes[1] as i32 << 16) | @@ -643,7 +643,7 @@ fn spawn_process_os(cfg: ProcessConfig, (errno >> 8) as u8, (errno >> 0) as u8, ]; - assert!(output.inner_write(bytes).is_ok()); + assert!(output.inner_write(&bytes).is_ok()); unsafe { libc::_exit(1) } } diff --git a/src/libnative/io/timer_unix.rs b/src/libnative/io/timer_unix.rs index 38895f2a8f96a..94108f239bb1d 100644 --- a/src/libnative/io/timer_unix.rs +++ b/src/libnative/io/timer_unix.rs @@ -190,7 +190,7 @@ fn helper(input: libc::c_int, messages: Receiver, _: ()) { // drain the file descriptor let mut buf = [0]; - assert_eq!(fd.inner_read(buf).ok().unwrap(), 1); + assert_eq!(fd.inner_read(&mut buf).ok().unwrap(), 1); } -1 if os::errno() == libc::EINTR as int => {} diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index 6606031989151..d90e0a9d514e7 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -349,7 +349,7 @@ mod tests { #[test] #[should_fail] fn test_weighted_choice_no_items() { - WeightedChoice::::new([]); + WeightedChoice::::new(&mut []); } #[test] #[should_fail] fn test_weighted_choice_zero_weight() { diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs index 2e048cb029d4a..e1cac38683294 100644 --- a/src/librand/distributions/range.rs +++ b/src/librand/distributions/range.rs @@ -185,9 +185,9 @@ mod tests { macro_rules! t ( ($($ty:ty),*) => {{ $( - let v: &[($ty, $ty)] = [(0, 10), - (10, 127), - (Bounded::min_value(), Bounded::max_value())]; + let v: &[($ty, $ty)] = &[(0, 10), + (10, 127), + (Bounded::min_value(), Bounded::max_value())]; for &(low, high) in v.iter() { let mut sampler: Range<$ty> = Range::new(low, high); for _ in range(0u, 1000) { @@ -210,10 +210,10 @@ mod tests { macro_rules! t ( ($($ty:ty),*) => {{ $( - let v: &[($ty, $ty)] = [(0.0, 100.0), - (-1e35, -1e25), - (1e-35, 1e-25), - (-1e35, 1e35)]; + let v: &[($ty, $ty)] = &[(0.0, 100.0), + (-1e35, -1e25), + (1e-35, 1e-25), + (-1e35, 1e35)]; for &(low, high) in v.iter() { let mut sampler: Range<$ty> = Range::new(low, high); for _ in range(0u, 1000) { diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 3c528c564a7ae..117cca1b8b572 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -142,7 +142,7 @@ pub trait Rng { /// use std::rand::{task_rng, Rng}; /// /// let mut v = [0u8, .. 13579]; - /// task_rng().fill_bytes(v); + /// task_rng().fill_bytes(&mut v); /// println!("{}", v.as_slice()); /// ``` fn fill_bytes(&mut self, dest: &mut [u8]) { @@ -268,7 +268,7 @@ pub trait Rng { /// /// let choices = [1i, 2, 4, 8, 16, 32]; /// let mut rng = task_rng(); - /// println!("{}", rng.choose(choices)); + /// println!("{}", rng.choose(&choices)); /// assert_eq!(rng.choose(choices[..0]), None); /// ``` fn choose<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> { @@ -288,9 +288,9 @@ pub trait Rng { /// /// let mut rng = task_rng(); /// let mut y = [1i, 2, 3]; - /// rng.shuffle(y); + /// rng.shuffle(&mut y); /// println!("{}", y.as_slice()); - /// rng.shuffle(y); + /// rng.shuffle(&mut y); /// println!("{}", y.as_slice()); /// ``` fn shuffle(&mut self, values: &mut [T]) { @@ -347,7 +347,7 @@ pub trait SeedableRng: Rng { /// let seed: &[_] = &[1, 2, 3, 4]; /// let mut rng: StdRng = SeedableRng::from_seed(seed); /// println!("{}", rng.gen::()); - /// rng.reseed([5, 6, 7, 8]); + /// rng.reseed(&[5, 6, 7, 8]); /// println!("{}", rng.gen::()); /// ``` fn reseed(&mut self, Seed); diff --git a/src/librbml/io.rs b/src/librbml/io.rs index 8917151609f81..b46b977d7012d 100644 --- a/src/librbml/io.rs +++ b/src/librbml/io.rs @@ -42,7 +42,7 @@ fn combine(seek: SeekStyle, cur: uint, end: uint, offset: i64) -> IoResult /// use rbml::io::SeekableMemWriter; /// /// let mut w = SeekableMemWriter::new(); -/// w.write([0, 1, 2]); +/// w.write(&[0, 1, 2]); /// /// assert_eq!(w.unwrap(), vec!(0, 1, 2)); /// ``` @@ -138,32 +138,32 @@ mod tests { fn test_seekable_mem_writer() { let mut writer = SeekableMemWriter::new(); assert_eq!(writer.tell(), Ok(0)); - writer.write([0]).unwrap(); + writer.write(&[0]).unwrap(); assert_eq!(writer.tell(), Ok(1)); - writer.write([1, 2, 3]).unwrap(); - writer.write([4, 5, 6, 7]).unwrap(); + writer.write(&[1, 2, 3]).unwrap(); + writer.write(&[4, 5, 6, 7]).unwrap(); assert_eq!(writer.tell(), Ok(8)); let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; assert_eq!(writer.get_ref(), b); writer.seek(0, io::SeekSet).unwrap(); assert_eq!(writer.tell(), Ok(0)); - writer.write([3, 4]).unwrap(); + writer.write(&[3, 4]).unwrap(); let b: &[_] = &[3, 4, 2, 3, 4, 5, 6, 7]; assert_eq!(writer.get_ref(), b); writer.seek(1, io::SeekCur).unwrap(); - writer.write([0, 1]).unwrap(); + writer.write(&[0, 1]).unwrap(); let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 7]; assert_eq!(writer.get_ref(), b); writer.seek(-1, io::SeekEnd).unwrap(); - writer.write([1, 2]).unwrap(); + writer.write(&[1, 2]).unwrap(); let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2]; assert_eq!(writer.get_ref(), b); writer.seek(1, io::SeekEnd).unwrap(); - writer.write([1]).unwrap(); + writer.write(&[1]).unwrap(); let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2, 0, 1]; assert_eq!(writer.get_ref(), b); } @@ -172,7 +172,7 @@ mod tests { fn seek_past_end() { let mut r = SeekableMemWriter::new(); r.seek(10, io::SeekSet).unwrap(); - assert!(r.write([3]).is_ok()); + assert!(r.write(&[3]).is_ok()); } #[test] diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index 1dfc0d970a91c..ebe82b0258b3e 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -598,7 +598,7 @@ pub mod reader { f: |&mut Decoder<'doc>, bool| -> DecodeResult) -> DecodeResult { debug!("read_option()"); self.read_enum("Option", |this| { - this.read_enum_variant(["None", "Some"], |this, idx| { + this.read_enum_variant(&["None", "Some"], |this, idx| { match idx { 0 => f(this, false), 1 => f(this, true), @@ -1075,34 +1075,34 @@ mod tests { let mut res: reader::Res; // Class A - res = reader::vuint_at(data, 0).unwrap(); + res = reader::vuint_at(&data, 0).unwrap(); assert_eq!(res.val, 0); assert_eq!(res.next, 1); - res = reader::vuint_at(data, res.next).unwrap(); + res = reader::vuint_at(&data, res.next).unwrap(); assert_eq!(res.val, (1 << 7) - 1); assert_eq!(res.next, 2); // Class B - res = reader::vuint_at(data, res.next).unwrap(); + res = reader::vuint_at(&data, res.next).unwrap(); assert_eq!(res.val, 0); assert_eq!(res.next, 4); - res = reader::vuint_at(data, res.next).unwrap(); + res = reader::vuint_at(&data, res.next).unwrap(); assert_eq!(res.val, (1 << 14) - 1); assert_eq!(res.next, 6); // Class C - res = reader::vuint_at(data, res.next).unwrap(); + res = reader::vuint_at(&data, res.next).unwrap(); assert_eq!(res.val, 0); assert_eq!(res.next, 9); - res = reader::vuint_at(data, res.next).unwrap(); + res = reader::vuint_at(&data, res.next).unwrap(); assert_eq!(res.val, (1 << 21) - 1); assert_eq!(res.next, 12); // Class D - res = reader::vuint_at(data, res.next).unwrap(); + res = reader::vuint_at(&data, res.next).unwrap(); assert_eq!(res.val, 0); assert_eq!(res.next, 16); - res = reader::vuint_at(data, res.next).unwrap(); + res = reader::vuint_at(&data, res.next).unwrap(); assert_eq!(res.val, (1 << 28) - 1); assert_eq!(res.next, 20); } diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs index 8c1d7c839acd0..7181c3a3cd7d2 100644 --- a/src/librustc/driver/config.rs +++ b/src/librustc/driver/config.rs @@ -868,11 +868,11 @@ mod test { #[test] fn test_switch_implies_cfg_test() { let matches = - &match getopts(["--test".to_string()], optgroups().as_slice()) { + &match getopts(&["--test".to_string()], optgroups().as_slice()) { Ok(m) => m, Err(f) => panic!("test_switch_implies_cfg_test: {}", f) }; - let registry = diagnostics::registry::Registry::new([]); + let registry = diagnostics::registry::Registry::new(&[]); let sessopts = build_session_options(matches); let sess = build_session(sessopts, None, registry); let cfg = build_configuration(&sess); @@ -884,14 +884,14 @@ mod test { #[test] fn test_switch_implies_cfg_test_unless_cfg_test() { let matches = - &match getopts(["--test".to_string(), "--cfg=test".to_string()], + &match getopts(&["--test".to_string(), "--cfg=test".to_string()], optgroups().as_slice()) { Ok(m) => m, Err(f) => { panic!("test_switch_implies_cfg_test_unless_cfg_test: {}", f) } }; - let registry = diagnostics::registry::Registry::new([]); + let registry = diagnostics::registry::Registry::new(&[]); let sessopts = build_session_options(matches); let sess = build_session(sessopts, None, registry); let cfg = build_configuration(&sess); diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index d347f113af322..03d345f76ed0a 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -543,7 +543,7 @@ pub fn phase_5_run_llvm_passes(sess: &Session, let output_type = write::OutputTypeAssembly; time(sess.time_passes(), "LLVM passes", (), |_| - write::run_passes(sess, trans, [output_type], outputs)); + write::run_passes(sess, trans, &[output_type], outputs)); write::run_assembler(sess, outputs); diff --git a/src/librustc/driver/mod.rs b/src/librustc/driver/mod.rs index 7715f0e10f559..96505b6fceadc 100644 --- a/src/librustc/driver/mod.rs +++ b/src/librustc/driver/mod.rs @@ -48,7 +48,7 @@ fn run_compiler(args: &[String]) { None => return }; - let descriptions = diagnostics::registry::Registry::new(super::DIAGNOSTICS); + let descriptions = diagnostics::registry::Registry::new(&super::DIAGNOSTICS); match matches.opt_str("explain") { Some(ref code) => { match descriptions.find_description(code.as_slice()) { diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index b9660dbd46629..d93893f2dd45b 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -345,7 +345,7 @@ fn parse_str(st: &mut PState, term: char) -> String { let mut result = String::new(); while peek(st) != term { unsafe { - result.as_mut_vec().push_all([next_byte(st)]) + result.as_mut_vec().push_all(&[next_byte(st)]) } } next(st); diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 5410417ec3f5c..83b0694c2c8b1 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -748,10 +748,10 @@ impl<'a> vtable_decoder_helpers for reader::Decoder<'a> { tcx: &ty::ctxt, cdata: &cstore::crate_metadata) -> typeck::vtable_origin { self.read_enum("vtable_origin", |this| { - this.read_enum_variant(["vtable_static", - "vtable_param", - "vtable_error", - "vtable_unboxed_closure"], + this.read_enum_variant(&["vtable_static", + "vtable_param", + "vtable_error", + "vtable_unboxed_closure"], |this, i| { Ok(match i { 0 => { @@ -1399,8 +1399,8 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> { -> typeck::MethodOrigin { self.read_enum("MethodOrigin", |this| { - let variants = ["MethodStatic", "MethodStaticUnboxedClosure", - "MethodTypeParam", "MethodTraitObject"]; + let variants = &["MethodStatic", "MethodStaticUnboxedClosure", + "MethodTypeParam", "MethodTraitObject"]; this.read_enum_variant(variants, |this, i| { Ok(match i { 0 => { @@ -1573,7 +1573,7 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> { fn read_auto_adjustment(&mut self, dcx: &DecodeContext) -> ty::AutoAdjustment { self.read_enum("AutoAdjustment", |this| { - let variants = ["AutoAddEnv", "AutoDerefRef"]; + let variants = &["AutoAddEnv", "AutoDerefRef"]; this.read_enum_variant(variants, |this, i| { Ok(match i { 0 => { @@ -1616,10 +1616,10 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> { fn read_autoref(&mut self, dcx: &DecodeContext) -> ty::AutoRef { self.read_enum("AutoRef", |this| { - let variants = ["AutoPtr", - "AutoUnsize", - "AutoUnsizeUniq", - "AutoUnsafe"]; + let variants = &["AutoPtr", + "AutoUnsize", + "AutoUnsizeUniq", + "AutoUnsafe"]; this.read_enum_variant(variants, |this, i| { Ok(match i { 0 => { @@ -1674,7 +1674,7 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> { fn read_unsize_kind(&mut self, dcx: &DecodeContext) -> ty::UnsizeKind { self.read_enum("UnsizeKind", |this| { - let variants = ["UnsizeLength", "UnsizeStruct", "UnsizeVtable"]; + let variants = &["UnsizeLength", "UnsizeStruct", "UnsizeVtable"]; this.read_enum_variant(variants, |this, i| { Ok(match i { 0 => { @@ -1723,7 +1723,7 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> { dcx.tcx, |s, a| this.convert_def_id(dcx, s, a))) }).unwrap(); - let variants = [ + let variants = &[ "FnUnboxedClosureKind", "FnMutUnboxedClosureKind", "FnOnceUnboxedClosureKind"