diff options
| author | Michael Hewson <michael@michaelhewson.ca> | 2018-09-20 03:12:00 -0400 |
|---|---|---|
| committer | Michael Hewson <michael@michaelhewson.ca> | 2018-11-01 18:15:19 -0400 |
| commit | d5c2c4a4339b2a6c64d16282d85bfd27bf01d361 (patch) | |
| tree | 0b24b58a863e34c40b83c8bbb151e792addfd991 /src/rustllvm/RustWrapper.cpp | |
| parent | be80a79a1ea247a71e5ffa408356b9b72cddb644 (diff) | |
| download | rust-d5c2c4a4339b2a6c64d16282d85bfd27bf01d361.tar.gz rust-d5c2c4a4339b2a6c64d16282d85bfd27bf01d361.zip | |
Implement the object-safety checks for arbitrary_self_types: part 1
For a trait method to be considered object-safe, the receiver type must
satisfy certain properties: first, we need to be able to get the vtable
to so we can look up the method, and second, we need to convert the
receiver from the version where `Self=dyn Trait`, to the version where
`Self=T`, `T` being some unknown, `Sized` type that implements `Trait`.
To check that the receiver satisfies those properties, we use the
following query:
forall (U) {
if (Self: Unsize<U>) {
Receiver[Self => U]: CoerceSized<Receiver>
}
}
where `Receiver` is the receiver type of the method (e.g. `Rc<Self>`),
and `Receiver[Self => U]` is the receiver type where `Self = U`, e.g.
`Rc<U>`.
forall queries like this aren’t implemented in the trait system yet, so
for now we are using a bit of a hack — see the code for explanation.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
