Open
Conversation
Member
Author
|
The branches this was based on have changed. If you review now, only 66cc89e matters (and I'll rebase it on top of what then will be main if we want to go that route) |
b99d855 to
2e06363
Compare
Member
Author
|
Rebased (and thus blocked by) #359. That already has the idiom of taking our |
2e06363 to
77be3c4
Compare
Member
Author
|
This conflicts with #379 (hax checks) -- not just in the simple merge-conflict style, but because hax is unhappy with a lot of things in typenum, and can't do const generic expressions (which is an unstable feature anyway). We might still offer the API under cfg(not(hax)), of offer an alternative (runtime panicking, but hax checkable) drop-in replacement. |
77be3c4 to
2e9b37e
Compare
This allows operations that are known to be infallible by construction of the minimal message size to be checked at buidl time.
2e9b37e to
fe7e776
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As a result of #361, the pushes to the buffers in early message building (first few bytes, where we know things will fit) are very
.unwrap()py. That is still OK there because it's an improvement over the explicit setting into content (that could also panic) and manual length setting (that could go wrong), but it's ugly.Either kind of panic should be easy to optimize away, and for hax to prove, but there are still downsides:
This approach is different in that it uses const generics (and occasionally typenum where const generics don't cut it, but for most parts that are user visible it's const generics) to perform a const assertion that the parts that are supposed to be infallible really are. (There's still a panic in there later, but if we trust the const generics we might even make that unsafe_unreachable, and at any rate, it's just one place to reason about).
This PR is currently in "initially run this by CI" stage, and not marked as a draft because I'd like feedback on the approach and whether we should follow this.
Small bycatch is that some buffers should really be tad bigger than the messages, and that we keep mixing up the buffer types as they're just type aliases and all the same.