public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Merge #1045
@ 2022-06-08 12:24 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:24 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e8b9587d3a0615f497cfe9c66995c1f21e42a536
commit e8b9587d3a0615f497cfe9c66995c1f21e42a536
Merge: 729bbacbd17 afa451b311d
Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
Date: Mon Mar 28 14:22:24 2022 +0000
Merge #1045
1045: Add initial support for unsized method resolution r=philberty a=philberty
In order to support slices, we end up with an operator overload call of:
```
impl<T, I> Index<I> for [T]
where
I: SliceIndex<[T]>,
{
type Output = I::Output;
fn index(&self, index: I) -> &I::Output {
index.index(self)
}
}
```
So this means the self, in this case, is an array[T,capacity] and the index parameter is of type Range<usize>. In order to actually call this method
which has a self parameter of [T] we need to be able to 'unsize' the array
into a slice.
Addresses #849
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diff:
gcc/rust/backend/rust-compile-base.h | 3 +++
gcc/rust/backend/rust-compile-expr.cc | 30 +++++++++++++++++++++++++++++
gcc/rust/typecheck/rust-autoderef.cc | 21 ++++++++++++++++++++
gcc/rust/typecheck/rust-autoderef.h | 5 +++++
gcc/rust/typecheck/rust-hir-dot-operator.cc | 15 +++++++++++++++
gcc/rust/typecheck/rust-hir-type-check.h | 1 +
gcc/rust/typecheck/rust-tyctx.cc | 7 +++++++
7 files changed, 82 insertions(+)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 12:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:24 [gcc/devel/rust/master] Merge #1045 Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).