mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Rollup merge of #155054 - Lars-Schumann:const-vec-ops, r=dtolnay
constify `Index(Mut)`, `Deref(Mut)` for `Vec` Relevant tracking issues const_convert: https://github.com/rust-lang/rust/issues/143773 const_index: https://github.com/rust-lang/rust/issues/143775
This commit is contained in:
@@ -106,6 +106,7 @@
|
||||
#![feature(const_destruct)]
|
||||
#![feature(const_eval_select)]
|
||||
#![feature(const_heap)]
|
||||
#![feature(const_index)]
|
||||
#![feature(const_option_ops)]
|
||||
#![feature(const_try)]
|
||||
#![feature(copied_into_inner)]
|
||||
|
||||
@@ -3747,7 +3747,8 @@ unsafe fn spec_extend_from_within(&mut self, src: Range<usize>) {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, A: Allocator> ops::Deref for Vec<T, A> {
|
||||
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
|
||||
impl<T, A: Allocator> const ops::Deref for Vec<T, A> {
|
||||
type Target = [T];
|
||||
|
||||
#[inline]
|
||||
@@ -3757,7 +3758,8 @@ fn deref(&self) -> &[T] {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, A: Allocator> ops::DerefMut for Vec<T, A> {
|
||||
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
|
||||
impl<T, A: Allocator> const ops::DerefMut for Vec<T, A> {
|
||||
#[inline]
|
||||
fn deref_mut(&mut self) -> &mut [T] {
|
||||
self.as_mut_slice()
|
||||
@@ -3822,7 +3824,8 @@ fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, I: SliceIndex<[T]>, A: Allocator> Index<I> for Vec<T, A> {
|
||||
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
|
||||
impl<T, I: [const] SliceIndex<[T]>, A: Allocator> const Index<I> for Vec<T, A> {
|
||||
type Output = I::Output;
|
||||
|
||||
#[inline]
|
||||
@@ -3832,7 +3835,8 @@ fn index(&self, index: I) -> &Self::Output {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, I: SliceIndex<[T]>, A: Allocator> IndexMut<I> for Vec<T, A> {
|
||||
#[rustc_const_unstable(feature = "const_index", issue = "143775")]
|
||||
impl<T, I: [const] SliceIndex<[T]>, A: Allocator> const IndexMut<I> for Vec<T, A> {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: I) -> &mut Self::Output {
|
||||
IndexMut::index_mut(&mut **self, index)
|
||||
|
||||
Reference in New Issue
Block a user