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

Qualify uses of __fuzz! macro #174

Merged
merged 2 commits into from
Sep 14, 2020
Merged

Qualify uses of __fuzz! macro #174

merged 2 commits into from
Sep 14, 2020

Conversation

smoelius
Copy link
Member

#161 introduced the __fuzz! macro, but did not refer to it with a qualified path. Consequently, users of afl.rs were forced to bring afl::__fuzz into their namespace, e.g., with use afl::*. This PR qualifies the uses of __fuzz! so that such a practice is no longer necessary.

For example, the following programs now compile, whereas they wouldn't before:

fn main() {
    afl::fuzz!(|data: &[u8]| {});
}
use afl::fuzz;

fn main() {
    fuzz!(|data: &[u8]| {});
}

Copy link
Member

@alex alex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using $crate would be slightly more idiomatic

@smoelius
Copy link
Member Author

I think using $crate would be slightly more idiomatic

I completely agree!

For others who weren't aware of this feature, it's described here: https://doc.rust-lang.org/reference/macros-by-example.html#hygiene

@alex alex merged commit 5142c99 into rust-fuzz:master Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants