diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-10-05 14:43:24 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-10-05 14:43:24 +0100 |
commit | 591b43e42e7f63841ce46fdd4f2760e47b6a7b0d (patch) | |
tree | ca78a39cfaa6563575ad6567d5cd30484bfcd08a /gcc/rust/backend/rust-compile-expr.h | |
parent | 6cd07341b1057961bebc8c11d70909ccac781113 (diff) | |
download | gcc-591b43e42e7f63841ce46fdd4f2760e47b6a7b0d.zip gcc-591b43e42e7f63841ce46fdd4f2760e47b6a7b0d.tar.gz gcc-591b43e42e7f63841ce46fdd4f2760e47b6a7b0d.tar.bz2 |
Coercion site type checking in CallExprs must hold onto the argument type
Coercion sites like CallExpr arguments must coerce the arguments for
type checking, but we must still insert the type of the actual argument
for that mapping not the coerced type. For example we might have:
```rust
fn dynamic_dispatch(t: &dyn Bar) {
t.baz();
}
fn main() {
let a = &Foo(123);
dynamic_dispatch(a);
}
```
Here the argument 'a' has a type of (&ADT{Foo}) but this is coerceable to
(&dyn{Bar}) which is fine. The backend needs to be able to detect the
coercion from the two types in order to generate the vtable code. This
patch fixes the type checking such that we store the actual type of
(&ADT{Foo}) at that argument mapping instead of the coerced one.
Addresses: #700
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.h')
0 files changed, 0 insertions, 0 deletions