Skip to content

Compiler Error with HasInstrumentationFilter Trait Implementation for QemuEdgeCoverageHelper #2037

@cube0x8

Description

@cube0x8

I'm encountering a compiler error when calling the update_filter method from the HasInstrumentationFilter trait on an instance of QemuEdgeCoverageHelper. The error message suggests that the compiler can't infer the type for the S type parameter in the HasInstrumentationFilter trait implementation for QemuEdgeCoverageHelper.

Here's the relevant code:

hooks
    .match_helper_mut::<QemuEdgeCoverageHelper>()
    .unwrap()
    .update_filter(
        QemuInstrumentationAddressRangeFilter::AllowList(ranges.clone()),
        &emu,
    );

The HasInstrumentationFilter trait is defined like this:

pub trait HasInstrumentationFilter<F, S>
where
    F: IsFilter,
{
    fn filter(&self) -> &F;

    fn filter_mut(&mut self) -> &mut F;

    fn update_filter(&mut self, filter: F, emu: &Qemu) {
        *self.filter_mut() = filter;
        emu.flush_jit();
    }
}

And QemuEdgeCoverageHelper is defined without any generic parameters.

The S type parameter is not used in the update_filter method or in the QemuEdgeCoverageHelper struct. I'm not sure why it's part of the HasInstrumentationFilter trait's definition or how to specify a type for S when calling update_filter.

Any help or guidance on how to resolve this issue would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions