diff --git a/fuzzers/others/libafl-fuzz/src/scheduler.rs b/fuzzers/others/libafl-fuzz/src/scheduler.rs index 0ddf7f137f..a5444a22a2 100644 --- a/fuzzers/others/libafl-fuzz/src/scheduler.rs +++ b/fuzzers/others/libafl-fuzz/src/scheduler.rs @@ -10,24 +10,18 @@ use libafl::{ state::{HasCorpus, HasRand, State}, Error, HasMetadata, }; -use libafl_bolts::{serdeany::SerdeAny, AsIter, HasRefCnt}; +use libafl_bolts::{serdeany::SerdeAny, tuples::MatchName, AsIter, HasRefCnt}; -pub enum SupportedSchedulers { - Queue(Q, PhantomData<(CS, F, I, M, O, S, Q)>), - Weighted( - MinimizerScheduler, - PhantomData<(CS, F, I, M, O, S, Q)>, - ), +pub enum SupportedSchedulers { + Queue(Q, PhantomData), + Weighted(W, PhantomData), } -impl RemovableScheduler for SupportedSchedulers +impl RemovableScheduler for SupportedSchedulers where - CS: Scheduler + RemovableScheduler, - F: TestcaseScore, I: Input, - M: for<'a> AsIter<'a, Item = usize> + SerdeAny + HasRefCnt, - O: CanTrack, Q: Scheduler + RemovableScheduler, + W: Scheduler + RemovableScheduler, S: UsesInput + HasTestcase + HasMetadata + HasCorpus + HasRand + State, { fn on_remove( @@ -50,14 +44,11 @@ where } } -impl Scheduler for SupportedSchedulers +impl Scheduler for SupportedSchedulers where - CS: Scheduler, - F: TestcaseScore, I: Input, - M: for<'a> AsIter<'a, Item = usize> + SerdeAny + HasRefCnt, - O: CanTrack, Q: Scheduler, + W: Scheduler, S: UsesInput + HasTestcase + HasMetadata + HasCorpus + HasRand + State, { fn on_add(&mut self, state: &mut S, id: CorpusId) -> Result<(), Error> { @@ -92,7 +83,7 @@ where } fn on_evaluation(&mut self, state: &mut S, input: &I, observers: &OTB) -> Result<(), Error> where - OTB: ObserversTuple, + OTB: MatchName, { match self { Self::Queue(queue, _) => queue.on_evaluation(state, input, observers), @@ -112,21 +103,15 @@ where } } -impl HasQueueCycles for SupportedSchedulers +impl HasQueueCycles for SupportedSchedulers where - CS: Scheduler + HasQueueCycles, - F: TestcaseScore, - I: Input, - M: for<'a> AsIter<'a, Item = usize> + SerdeAny + HasRefCnt, - - O: CanTrack, - Q: Scheduler + HasQueueCycles, - S: UsesInput + HasTestcase + HasMetadata + HasCorpus + HasRand + State, + Q: HasQueueCycles, + W: HasQueueCycles, { fn queue_cycles(&self) -> u64 { match self { Self::Queue(queue, _) => queue.queue_cycles(), - Self::Weighted(weighted, _) => weighted.base().queue_cycles(), + Self::Weighted(weighted, _) => weighted.queue_cycles(), } } } diff --git a/libafl/src/schedulers/minimizer.rs b/libafl/src/schedulers/minimizer.rs index f6bcaafa13..eb36d85a0e 100644 --- a/libafl/src/schedulers/minimizer.rs +++ b/libafl/src/schedulers/minimizer.rs @@ -8,6 +8,7 @@ use hashbrown::{HashMap, HashSet}; use libafl_bolts::{rands::Rand, serdeany::SerdeAny, tuples::MatchName, AsIter, HasRefCnt}; use serde::{Deserialize, Serialize}; +use super::HasQueueCycles; use crate::{ corpus::{Corpus, CorpusId, Testcase}, feedbacks::MapIndexesMetadata, @@ -350,7 +351,14 @@ where Ok(()) } } - +impl HasQueueCycles for MinimizerScheduler +where + CS: HasQueueCycles, +{ + fn queue_cycles(&self) -> u64 { + self.base.queue_cycles() + } +} impl MinimizerScheduler where O: CanTrack,