-
Notifications
You must be signed in to change notification settings - Fork 1
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
Replace multi_cartesian_product with a correct version #73
Comments
Locations where we need to replace it (from
|
tchajed
pushed a commit
that referenced
this issue
Jul 11, 2023
This PR implements a corrected wrapper around `itertools::multi_cartesian_product`. I added a CI lint that forbids the string `multi_cartesian_product` (as a standalone word, not a substring, as decided by `grep -w`) from the code base. Use the wrapper `multi_cartesian_product_fixed` instead. I ported all existing call sites to use the fixed version. I considered each call site manually and convinced myself that either the iterator was never empty or that the old code did not correctly handle that case already. I also removed some obvious workarounds that handled the empty iterator case separately to avoid the bug. Fixes #73 --------- Signed-off-by: James R. Wilcox <wilcoxjay@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We currently use itertools::multi_cartesian_product in many places. Unfortunately it doesn't handle empty iterators correctly (it produces no results when it should produce a single empty result); see rust-itertools/itertools#337. In several places we handle this ourselves but it would be better to just use a correct version everywhere.
We can implement the correct version by wrapping itertools::multi_cartesian_product.
The text was updated successfully, but these errors were encountered: