diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-11-02 17:53:22 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-11-05 11:33:04 +0000 |
commit | f4c200fcfec75b3841640263609d2133ead0c518 (patch) | |
tree | df69a9a457f78df72414ad73a10de5714bdc5086 /gcc/rust/backend/rust-compile-item.h | |
parent | 92a24fc3aecc11fc80387479829ea97293c44076 (diff) | |
download | gcc-f4c200fcfec75b3841640263609d2133ead0c518.zip gcc-f4c200fcfec75b3841640263609d2133ead0c518.tar.gz gcc-f4c200fcfec75b3841640263609d2133ead0c518.tar.bz2 |
Support computing the addresses of the object safe items in dyn objects
This changes the coercion code for the dyn vtable to compute addresses
for more complex generic methods such as:
```
impl<'a, T> FnLike<&'a T, &'a T> for Identity {
fn call(&self, arg: &'a T) -> &'a T {
arg
}
}
```
In the above example the fntype for the bound FnLike is generic and
bound to the ParamType 'T' from the generic impl-block. But the bound
which has a signiture which is compatible for the impl block looks like:
```
trait FnLike<A, R> {
fn call(&self, arg: A) -> R;
}
```
This means when we have the trait-object bound:
```
type FnObject<'b> = dyn for<'a> FnLike<&'a isize, &'a isize> + 'b
```
We must be able to figure out that the signiture of the impl block item
```
fn call(&self, arg: &'a T) -> &'a T;
```
T must be substituted with &isize from the arguments used in the bound.
Fixes #786
Diffstat (limited to 'gcc/rust/backend/rust-compile-item.h')
0 files changed, 0 insertions, 0 deletions