Closed mkeeter closed 9 months ago
It likely needs some kind of bound like where D::Relocation=X64Relocation
(or where <D as DynasmLabelApi>::Relocation=X64Relocation
).
After some fighting with the compiler, the correct signature is
pub fn loopy<D: DynasmApi + DynasmLabelApi<Relocation = dynasmrt::aarch64::Aarch64Relocation>>(
ops: &mut D,
) {
Thanks!
I recently tried to make my functions more generic, taking a
<D: DynasmApi + DynasmLabelApi>
instead of aVecAssembler
. To my surprise, this doesn't compile:It expands to
It seems like codegen is happy to generate
kind: <Self::Relocation as Relocation>::Encoding
as a(u8,)
, but the trait bounds ofDynasmApi + DynasmLabelApi
don't actually enforce that type, so we can't write this generic code.I could add a further constraint
<<D as DynasmLabelApi>::Relocation as Relocation>::Encoding: (u8,)
, but that's awfully wordy!