Skip to content

Commit

Permalink
Auto merge of #28197 - petrochenkov:borrow, r=alexcrichton
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Sep 4, 2015
2 parents 668dac4 + 52417d5 commit 1110f1e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/libcore/array.rs
Expand Up @@ -19,6 +19,7 @@
integer constants",
issue = "27778")]

use borrow::{Borrow, BorrowMut};
use clone::Clone;
use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
use convert::{AsRef, AsMut};
Expand Down Expand Up @@ -70,6 +71,20 @@ macro_rules! array_impls {
}
}

#[stable(feature = "array_borrow", since = "1.4.0")]
impl<T> Borrow<[T]> for [T; $N] {
fn borrow(&self) -> &[T] {
self
}
}

#[stable(feature = "array_borrow", since = "1.4.0")]
impl<T> BorrowMut<[T]> for [T; $N] {
fn borrow_mut(&mut self) -> &mut [T] {
self
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T:Copy> Clone for [T; $N] {
fn clone(&self) -> [T; $N] {
Expand Down

0 comments on commit 1110f1e

Please sign in to comment.