Add MapWindows compile fail check for N=0#121156
Add MapWindows compile fail check for N=0#121156Nydauron wants to merge 2 commits intorust-lang:masterfrom
MapWindows compile fail check for N=0#121156Conversation
Checks if const generic N is not set to 0, otherwise it prevents compilation.
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
MapWindow compile fail check for N=0MapWindows compile fail check for N=0
|
We do want something like this in various places such as We need some combination of |
|
r? @the8472 since it sounds like you have more context here. Failing that this is probably T-libs-api (though it's unstable so maybe not strictly required). |
|
Context, previous PRs that tried to do something similar and were rejected because we currently lack the language features to make this ergonomic for users:
Stabilization of various features is also blocked or at least less likely until we have a better solution: So for now I'll close this until some progress gets made on the questions in those issues. |
Related to issue #87155. Adds a constant assertion to
MapWindowsto check if genericN, representing the size of the window array, is not zero. Before, a zero-length window array would causeMapWindowsto panic at runtime. With the const assert, ifN=0, the code will not compile.A map window test that dealt with a zero-width array is moved to the
Iterator::map_windowsdoc-tests in order to check for compilation failure. Before this change, the test was meant to panic.