mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
unsize cast array only on pointer type
This commit is contained in:
parent
0fcef7fdd3
commit
0bf0d937b8
4 changed files with 43 additions and 18 deletions
|
@ -273,6 +273,24 @@ pub mod ops {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T, I, const N: usize> Index<I> for [T; N]
|
||||
where
|
||||
I: SliceIndex<[T]>,
|
||||
{
|
||||
type Output = I::Output;
|
||||
fn index(&self, index: I) -> &I::Output {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
impl<T, I, const N: usize> IndexMut<I> for [T; N]
|
||||
where
|
||||
I: SliceIndex<[T]>,
|
||||
{
|
||||
fn index_mut(&mut self, index: I) -> &mut I::Output {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe trait SliceIndex<T: ?Sized> {
|
||||
type Output: ?Sized;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue