Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0d5bcb1

Browse files
committedMar 3, 2015
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.
1 parent b03279a commit 0d5bcb1

File tree

118 files changed

+349
-373
lines changed

Some content is hidden

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

118 files changed

+349
-373
lines changed
 

‎src/liballoc/boxed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl<T: Default> Default for Box<T> {
157157
#[stable(feature = "rust1", since = "1.0.0")]
158158
impl<T> Default for Box<[T]> {
159159
#[stable(feature = "rust1", since = "1.0.0")]
160-
fn default() -> Box<[T]> { box [] }
160+
fn default() -> Box<[T]> { Box::<[T; 0]>::new([]) }
161161
}
162162

163163
#[stable(feature = "rust1", since = "1.0.0")]

‎src/libcoretest/hash/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ fn test_writer_hasher() {
6464
//assert_eq!(hasher.hash(& s), 97 + 0xFF);
6565
let cs: &[u8] = &[1u8, 2u8, 3u8];
6666
assert_eq!(hash(& cs), 9);
67-
let cs: Box<[u8]> = box [1u8, 2u8, 3u8];
67+
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
68+
let cs: Box<[u8]> = Box::new([1u8, 2u8, 3u8]);
6869
assert_eq!(hash(& cs), 9);
6970

7071
// FIXME (#18248) Add tests for hashing Rc<str> and Rc<[T]>

0 commit comments

Comments
 (0)
Please sign in to comment.