Closed
Description
@eddyb suggests to use something in https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/abi/call/index.html instead of https://github.com/rust-lang/rust/blob/c610be92e2925ab8e789efc835c88247e46c6cbf/src/librustc_mir/interpret/terminator/mod.rs#L191.
IRC log:
<eddyb> RalfJ: yeah you can basically emulate ABIs!
<eddyb> RalfJ: the PassMode variant must always match. direct (including pairs) must have the same layout primitive, cast must use the same register "shape", and indirect has no requirements
<eddyb> RalfJ: for direct I doubt you can have anything other than scalars, scalar pairs and vectors, and for at least the first two you can just reuse the miri value and change the type
<eddyb> RalfJ: for cast & indirect, you basically need to do a memcpy/union type-cast
<eddyb> if you want you can check that the size matches *but that's not actually required* (in terms of things working, that is)
<eddyb> RalfJ: especially if we'll get virtual calls with by-value self, it's gonna be indirect on both sides but one of the sides might only know the zero-sized unsized `dyn Trait` type, whereas the other has the full type
<eddyb> RalfJ: now this is still somewhat imprecise
Unfortunately I have no idea yet what all of that means. ;)
Metadata
Metadata
Assignees
Labels
No labels