mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
Auto merge of #28197 - petrochenkov:borrow, r=alexcrichton
This commit is contained in:
commit
1110f1e873
@ -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};
|
||||
@ -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] {
|
||||
|
Loading…
Reference in New Issue
Block a user