diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-03-21 12:40:20 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-03-21 12:40:20 +0000 |
commit | afa451b311dec27476941e6f307d04450d28ab88 (patch) | |
tree | 7b7687f8ecd77c56213f13347f0c1491902cd26a /gcc/rust/backend/rust-compile-base.h | |
parent | 1bb9a29688ab4ddfec7f8d36ca2cee63c5f258d2 (diff) | |
download | gcc-afa451b311dec27476941e6f307d04450d28ab88.zip gcc-afa451b311dec27476941e6f307d04450d28ab88.tar.gz gcc-afa451b311dec27476941e6f307d04450d28ab88.tar.bz2 |
Add initial support for unsized method resolution
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
Diffstat (limited to 'gcc/rust/backend/rust-compile-base.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-base.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-base.h b/gcc/rust/backend/rust-compile-base.h index c30aa4d..c7f7f40 100644 --- a/gcc/rust/backend/rust-compile-base.h +++ b/gcc/rust/backend/rust-compile-base.h @@ -72,6 +72,9 @@ protected: tree resolve_indirection_adjustment (Resolver::Adjustment &adjustment, tree expression, Location locus); + tree resolve_unsized_adjustment (Resolver::Adjustment &adjustment, + tree expression, Location locus); + static void setup_attributes_on_fndecl ( tree fndecl, bool is_main_entry_point, HIR::Visibility &visibility, const HIR::FunctionQualifiers &qualifiers, const AST::AttrVec &attrs); |