Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a97abb4
Rename LayoutErr to LayoutError in core
Sep 24, 2020
bf0adc3
Rename LayoutErr to LayoutError outside of core
Sep 25, 2020
0266c13
Deprecate LayoutErr
Sep 28, 2020
2b1fa1f
Update RELEASES.md for 1.48.0
XAMPPRocky Oct 25, 2020
ff89b80
Update RELEASES.md
XAMPPRocky Oct 25, 2020
a268264
Update RELEASES.md
XAMPPRocky Oct 25, 2020
149ca76
Apply suggestions from code review
XAMPPRocky Oct 25, 2020
3cb0775
Apply suggestions from code review
XAMPPRocky Oct 26, 2020
a9a26b8
Update RELEASES.md
XAMPPRocky Oct 26, 2020
e6bf0c3
Update RELEASES.md
XAMPPRocky Oct 26, 2020
1186f28
Update RELEASES.md
XAMPPRocky Oct 26, 2020
8ff0c14
Change layouterr deprecation message
Oct 27, 2020
3f6726d
Update RELEASES.md
XAMPPRocky Oct 27, 2020
1c6d4d2
Update RELEASES.md
XAMPPRocky Oct 27, 2020
c899998
Update RELEASES.md
XAMPPRocky Oct 27, 2020
0a9cf84
Update RELEASES.md
XAMPPRocky Oct 29, 2020
5058cad
Remove unneeded lifetimes in array/mod.rs
est31 Nov 5, 2020
6728240
Test structural matching for all range types
CDirkx Nov 7, 2020
72e9660
Remove io::LocalOutput and use Arc<Mutex<dyn>> for local streams.
m-ou-se Nov 3, 2020
ccbce1d
Update tests for updated set_panic.
m-ou-se Nov 3, 2020
f534b75
Use Vec<u8> for LOCAL_STD{OUT,ERR} instead of dyn Write.
m-ou-se Nov 3, 2020
08b7cb7
Use Cell instead of RefCell for LOCAL_{STDOUT,STDERR}.
m-ou-se Nov 3, 2020
aff7bd6
Merge set_panic and set_print into set_output_capture.
m-ou-se Nov 3, 2020
8972bcb
BTreeMap: test chaotic ordering & other bits & bobs
ssomers Nov 9, 2020
a81a64e
Update RELEASES.md
XAMPPRocky Nov 12, 2020
49c0b31
tbh what
lcnr Nov 13, 2020
06c9c59
lessen restriction in `check_kind_count`
lcnr Nov 13, 2020
c34350a
Add tests and improve rendering of features on traits
Nemo157 Nov 2, 2020
d6c16e4
Make all rustdoc functions and structs crate-private
jyn514 Nov 14, 2020
9a3548c
Fix warnings
jyn514 Nov 14, 2020
487c0ce
Make `markdown` module public for doc-tests
jyn514 Nov 15, 2020
9b84c91
Make `Playground` public for error index generator
jyn514 Nov 15, 2020
c03dfa6
Implement Index[Mut] for arrays
pubfnbar Jul 31, 2020
69b43c2
improve error message for const ty param mismatch
lcnr Nov 13, 2020
0bc04e3
Update E0744 about control flow in `const` contexts to reflect the cu…
ThePuzzlemaker Nov 16, 2020
4cdd220
Rollup merge of #74989 - pubfnbar:impl-array-indexing, r=KodrAus
m-ou-se Nov 16, 2020
de0aa61
Rollup merge of #76339 - CDirkx:structural-match-range, r=Mark-Simula…
m-ou-se Nov 16, 2020
5bbf75d
Rollup merge of #77691 - exrook:rename-layouterr, r=KodrAus
m-ou-se Nov 16, 2020
c75f210
Rollup merge of #78364 - XAMPPRocky:relnote-1.48.0, r=pietroalbini
m-ou-se Nov 16, 2020
7a1bd80
Rollup merge of #78678 - Nemo157:doc-cfg-w-traits, r=jyn514,Guillaume…
m-ou-se Nov 16, 2020
11ce918
Rollup merge of #78714 - m-ou-se:simplify-local-streams, r=KodrAus
m-ou-se Nov 16, 2020
c0a9bf9
Rollup merge of #78769 - est31:remove_lifetimes, r=KodrAus
m-ou-se Nov 16, 2020
bac213b
Rollup merge of #78903 - ssomers:btree_order_chaos_testing, r=Mark-Si…
m-ou-se Nov 16, 2020
835faa5
Rollup merge of #79032 - lcnr:arg-count, r=varkor
m-ou-se Nov 16, 2020
c3da682
Rollup merge of #79061 - jyn514:no-pub, r=GuillaumeGomez
m-ou-se Nov 16, 2020
e6b6c8e
Rollup merge of #79087 - ThePuzzlemaker:issue-79083-docfix, r=RalfJung
m-ou-se Nov 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Implement Index[Mut] for arrays
Adds implementations of `Index` and `IndexMut` for arrays that simply forward to the slice indexing implementation.
  • Loading branch information
pubfnbar authored and Mark-Simulacrum committed Nov 16, 2020
commit c03dfa6671bb462d243c12c72c8829f98c99e394
25 changes: 25 additions & 0 deletions library/core/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::convert::{Infallible, TryFrom};
use crate::fmt;
use crate::hash::{self, Hash};
use crate::marker::Unsize;
use crate::ops::{Index, IndexMut};
use crate::slice::{Iter, IterMut};

mod iter;
Expand Down Expand Up @@ -208,6 +209,30 @@ impl<'a, T, const N: usize> IntoIterator for &'a mut [T; N] {
}
}

#[stable(feature = "index_trait_on_arrays", since = "1.50.0")]
impl<T, I, const N: usize> Index<I> for [T; N]
where
[T]: Index<I>,
{
type Output = <[T] as Index<I>>::Output;

#[inline]
fn index(&self, index: I) -> &Self::Output {
Index::index(self as &[T], index)
}
}

#[stable(feature = "index_trait_on_arrays", since = "1.50.0")]
impl<T, I, const N: usize> IndexMut<I> for [T; N]
where
[T]: IndexMut<I>,
{
#[inline]
fn index_mut(&mut self, index: I) -> &mut Self::Output {
IndexMut::index_mut(self as &mut [T], index)
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<A, B, const N: usize> PartialEq<[B; N]> for [A; N]
where
Expand Down