-
Notifications
You must be signed in to change notification settings - Fork 228
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
Add methods for creating/checking for poison
values.
#431
Conversation
This patch adds `get_poison()` methods to `*Type`, as well as `is_poison()` methods to `*Value`, implemented almost identically to the corresponding `get_undef()`/`is_undef()` methods. This is particularly useful for operations on vector types, as the use of `poison` for masks, shuffles, and inserts is idiomatic.
Is it valid and correct for any single type imaginable to be poisionable? If so maybe it makes more sense to add the method to the |
Hmm, OK. I figured I would mirror what was done with |
Two immediate downsides of moving the method to the trait:
|
I see #1 as an advantage since it reduces the api surface and makes the functionality generic. As for 2, I'm not really sure what you mean. IntValue implements the any trait so it's able to use the method |
Just to be clear, you mean move the |
I think I see what you're saying. It could be an associated type if we still want to go down that route. But we don't have to |
Perhaps if you're inclined to take a stab, that could be worked. When I tried, that seemed to make the changes much broader in scope (had to specify the associated type everywhere A more pressing issue (reason why the CI failed) seems to be that |
As a side note: It does looks like I can move |
Sounds good, let's not increase the scope then for now |
@TheDan64 I think I need your approval for another CI run, when you get the chance. |
Whoops, forgot to import |
@TheDan64 CI appears to be passing, just needs a review. |
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.
Thank you!
Description
This patch adds
get_poison()
methods to*Type
, as well asis_poison()
methods to*Value
, implemented identically to the correspondingget_undef()
/is_undef()
methods. This is particularly useful for operations on vector types, as the use ofpoison
for masks, shuffles, and inserts is idiomatic.How This Has Been Tested
cargo test --features llvm15-0
locally.poison
values.Checklist