Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate state trait/impl for generative fuzzers #2304

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions libafl/src/feedbacks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use crate::{
events::EventFirer,
executors::ExitKind,
observers::{ObserversTuple, TimeObserver},
state::State,
state::GenState,
Error,
};
#[cfg(feature = "std")]
Expand All @@ -59,7 +59,7 @@ pub mod transferred;
/// indicating the "interestingness" of the last run.
pub trait Feedback<S>: Named
where
S: State,
S: GenState,
{
/// Initializes the feedback state.
/// This method is called after that the `State` is created.
Expand Down Expand Up @@ -170,7 +170,7 @@ where
A: Feedback<S>,
B: Feedback<S>,
FL: FeedbackLogic<A, B, S>,
S: State,
S: GenState,
{
/// First [`Feedback`]
pub first: A,
Expand All @@ -185,7 +185,7 @@ where
A: Feedback<S>,
B: Feedback<S>,
FL: FeedbackLogic<A, B, S>,
S: State,
S: GenState,
{
fn name(&self) -> &Cow<'static, str> {
&self.name
Expand All @@ -197,7 +197,7 @@ where
A: Feedback<S>,
B: Feedback<S>,
FL: FeedbackLogic<A, B, S>,
S: State,
S: GenState,
{
/// Create a new combined feedback
pub fn new(first: A, second: B) -> Self {
Expand All @@ -221,7 +221,7 @@ where
A: Feedback<S>,
B: Feedback<S>,
FL: FeedbackLogic<A, B, S>,
S: State,
S: GenState,
{
fn init_state(&mut self, state: &mut S) -> Result<(), Error> {
self.first.init_state(state)?;
Expand Down Expand Up @@ -316,7 +316,7 @@ where
A: Feedback<S> + FeedbackFactory<A, T>,
B: Feedback<S> + FeedbackFactory<B, T>,
FL: FeedbackLogic<A, B, S>,
S: State,
S: GenState,
{
fn create_feedback(&self, ctx: &T) -> CombinedFeedback<A, B, FL, S> {
CombinedFeedback::new(
Expand All @@ -331,7 +331,7 @@ pub trait FeedbackLogic<A, B, S>: 'static
where
A: Feedback<S>,
B: Feedback<S>,
S: State,
S: GenState,
{
/// The name of this combination
fn name() -> &'static str;
Expand Down Expand Up @@ -416,7 +416,7 @@ impl<A, B, S> FeedbackLogic<A, B, S> for LogicEagerOr
where
A: Feedback<S>,
B: Feedback<S>,
S: State,
S: GenState,
{
fn name() -> &'static str {
"Eager OR"
Expand Down Expand Up @@ -487,7 +487,7 @@ impl<A, B, S> FeedbackLogic<A, B, S> for LogicFastOr
where
A: Feedback<S>,
B: Feedback<S>,
S: State,
S: GenState,
{
fn name() -> &'static str {
"Fast OR"
Expand Down Expand Up @@ -565,7 +565,7 @@ impl<A, B, S> FeedbackLogic<A, B, S> for LogicEagerAnd
where
A: Feedback<S>,
B: Feedback<S>,
S: State,
S: GenState,
{
fn name() -> &'static str {
"Eager AND"
Expand Down Expand Up @@ -632,7 +632,7 @@ impl<A, B, S> FeedbackLogic<A, B, S> for LogicFastAnd
where
A: Feedback<S>,
B: Feedback<S>,
S: State,
S: GenState,
{
fn name() -> &'static str {
"Fast AND"
Expand Down Expand Up @@ -731,7 +731,7 @@ pub type FastOrFeedback<A, B, S> = CombinedFeedback<A, B, LogicFastOr, S>;
pub struct NotFeedback<A, S>
where
A: Feedback<S>,
S: State,
S: GenState,
{
/// The feedback to invert
pub first: A,
Expand All @@ -743,7 +743,7 @@ where
impl<A, S> Debug for NotFeedback<A, S>
where
A: Feedback<S> + Debug,
S: State,
S: GenState,
{
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.debug_struct("NotFeedback")
Expand All @@ -756,7 +756,7 @@ where
impl<A, S> Feedback<S> for NotFeedback<A, S>
where
A: Feedback<S>,
S: State,
S: GenState,
{
fn init_state(&mut self, state: &mut S) -> Result<(), Error> {
self.first.init_state(state)
Expand Down Expand Up @@ -810,7 +810,7 @@ where
impl<A, S> Named for NotFeedback<A, S>
where
A: Feedback<S>,
S: State,
S: GenState,
{
#[inline]
fn name(&self) -> &Cow<'static, str> {
Expand All @@ -821,7 +821,7 @@ where
impl<A, S> NotFeedback<A, S>
where
A: Feedback<S>,
S: State,
S: GenState,
{
/// Creates a new [`NotFeedback`].
pub fn new(first: A) -> Self {
Expand Down Expand Up @@ -889,7 +889,7 @@ macro_rules! feedback_not {
/// Hack to use () as empty Feedback
impl<S> Feedback<S> for ()
where
S: State,
S: GenState,
{
#[allow(clippy::wrong_self_convention)]
fn is_interesting<EM, OT>(
Expand Down Expand Up @@ -922,7 +922,7 @@ pub struct CrashFeedback {

impl<S> Feedback<S> for CrashFeedback
where
S: State,
S: GenState,
{
#[allow(clippy::wrong_self_convention)]
fn is_interesting<EM, OT>(
Expand Down Expand Up @@ -992,7 +992,7 @@ pub struct TimeoutFeedback {

impl<S> Feedback<S> for TimeoutFeedback
where
S: State,
S: GenState,
{
#[allow(clippy::wrong_self_convention)]
fn is_interesting<EM, OT>(
Expand Down Expand Up @@ -1063,7 +1063,7 @@ pub struct DiffExitKindFeedback {

impl<S> Feedback<S> for DiffExitKindFeedback
where
S: State,
S: GenState,
{
#[allow(clippy::wrong_self_convention)]
fn is_interesting<EM, OT>(
Expand Down Expand Up @@ -1133,7 +1133,7 @@ pub struct TimeFeedback {

impl<S> Feedback<S> for TimeFeedback
where
S: State,
S: GenState,
{
#[allow(clippy::wrong_self_convention)]
fn is_interesting<EM, OT>(
Expand Down Expand Up @@ -1211,7 +1211,7 @@ pub enum ConstFeedback {

impl<S> Feedback<S> for ConstFeedback
where
S: State,
S: GenState,
{
#[inline]
#[allow(clippy::wrong_self_convention)]
Expand Down
Loading
Loading