diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-02-15 09:52:21 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-03-03 21:05:55 +0100 |
| commit | 0d5bcb14adb71900a99f06b92485de7e019734c2 (patch) | |
| tree | 37b9faace62c6658ff6ecf9d646e04c01be875fb /src/libcoretest | |
| parent | b03279aaa2b20f6033e66fc7aea29c0b43e71082 (diff) | |
| download | rust-0d5bcb14adb71900a99f06b92485de7e019734c2.tar.gz rust-0d5bcb14adb71900a99f06b92485de7e019734c2.zip | |
Switched to Box::new in many places.
Many of the modifications putting in `Box::new` calls also include a pointer to Issue 22405, which tracks going back to `box <expr>` if possible in the future. (Still tried to use `Box<_>` where it sufficed; thus some tests still have `box_syntax` enabled, as they use a mix of `box` and `Box::new`.) Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
Diffstat (limited to 'src/libcoretest')
| -rw-r--r-- | src/libcoretest/hash/mod.rs | 3 | ||||
| -rw-r--r-- | src/libcoretest/iter.rs | 11 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/libcoretest/hash/mod.rs b/src/libcoretest/hash/mod.rs index 9b6af182f72..da96680d84b 100644 --- a/src/libcoretest/hash/mod.rs +++ b/src/libcoretest/hash/mod.rs @@ -64,7 +64,8 @@ fn test_writer_hasher() { //assert_eq!(hasher.hash(& s), 97 + 0xFF); let cs: &[u8] = &[1u8, 2u8, 3u8]; assert_eq!(hash(& cs), 9); - let cs: Box<[u8]> = box [1u8, 2u8, 3u8]; + // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. + let cs: Box<[u8]> = Box::new([1u8, 2u8, 3u8]); assert_eq!(hash(& cs), 9); // FIXME (#18248) Add tests for hashing Rc<str> and Rc<[T]> diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index abf88583c03..b1b10b582e5 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -404,7 +404,8 @@ fn test_collect() { #[test] fn test_all() { - let v: Box<[int]> = box [1, 2, 3, 4, 5]; + // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. + let v: Box<[int]> = Box::new([1, 2, 3, 4, 5]); assert!(v.iter().all(|&x| x < 10)); assert!(!v.iter().all(|&x| x % 2 == 0)); assert!(!v.iter().all(|&x| x > 100)); @@ -413,7 +414,8 @@ fn test_all() { #[test] fn test_any() { - let v: Box<[int]> = box [1, 2, 3, 4, 5]; + // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. + let v: Box<[int]> = Box::new([1, 2, 3, 4, 5]); assert!(v.iter().any(|&x| x < 10)); assert!(v.iter().any(|&x| x % 2 == 0)); assert!(!v.iter().any(|&x| x > 100)); @@ -581,8 +583,9 @@ fn test_rposition() { #[test] #[should_fail] fn test_rposition_panic() { - let v = [(box 0, box 0), (box 0, box 0), - (box 0, box 0), (box 0, box 0)]; + let v: [(Box<_>, Box<_>); 4] = + [(box 0, box 0), (box 0, box 0), + (box 0, box 0), (box 0, box 0)]; let mut i = 0; v.iter().rposition(|_elt| { if i == 2 { |
