-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Support MIRI by using naive
implementations
#67
Conversation
Closes #51 Some reordering was introduced in `cfg` attributes to make it consistent
Woops, looking into breakage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
src/lib.rs
Outdated
target_arch = "x86_64", | ||
memchr_runtime_simd, | ||
memchr_libc | ||
)))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is your issue. I think you want:
#[cfg(all(
not(memchr_libc),
not(all(target_arch = "x86_64", memchr_runtime_simd)),
not(miri),
))]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, !A && !(B && C)
is (!A && !B) || (!A && !C)
🤦♂️
src/lib.rs
Outdated
#[inline(always)] | ||
fn imp(n1: u8, haystack: &[u8]) -> Option<usize> { | ||
x86::memchr(n1, haystack) | ||
} | ||
|
||
#[cfg(all( | ||
memchr_libc, | ||
not(all(target_arch = "x86_64", memchr_runtime_simd)) | ||
not(all(miri, target_arch = "x86_64", memchr_runtime_simd)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using similar cfg knobs, could you make sure they are in the same order? e.g., I'd put miri
last here, in order to match all(target_arch = "x86_64", memchr_runtime_simd, not(miri))
above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I appreciate you persisting without the use of cfg-if
. I know it's a pain.
This is on crates.io in |
Thanks for the crate, the help and the responsiveness! Much appreciated |
Closes #51
Some reordering was introduced in
cfg
attributes to make it consistentbecomes
It highlights which component of the conditional is important/introduced by putting them first