Skip to content

Commit 1769c98

Browse files
committed
Make empty arrays Copy
1 parent 6dff9d0 commit 1769c98

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/libcore/array.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ macro_rules! array_impl_clone {
216216
};
217217
{$n:expr,} => {
218218
#[stable(feature = "rust1", since = "1.0.0")]
219-
impl<T: Clone> Clone for [T; 0] {
219+
impl<T> Clone for [T; 0] {
220220
fn clone(&self) -> [T; 0] {
221221
[]
222222
}

src/librustc/middle/traits/select.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1720,9 +1720,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17201720
}
17211721
}
17221722

1723-
ty::TyArray(element_ty, _) => {
1723+
ty::TyArray(element_ty, n) => {
17241724
// [T; n]
17251725
match bound {
1726+
ty::BoundCopy if n == 0 => ok_if(Vec::new()),
17261727
ty::BoundCopy => ok_if(vec![element_ty]),
17271728
ty::BoundSized => ok_if(Vec::new()),
17281729
ty::BoundSync | ty::BoundSend => {

0 commit comments

Comments
 (0)