Closed
Conversation
b91a49a to
c2b946e
Compare
547c468 to
f72320b
Compare
c2b946e to
7dec672
Compare
joshlf
commented
Sep 8, 2023
320bc2c to
879638f
Compare
f72320b to
da9e996
Compare
da9e996 to
d8b1ce6
Compare
879638f to
002bb4a
Compare
d8b1ce6 to
87cd2a8
Compare
002bb4a to
d43fadf
Compare
87cd2a8 to
7adbc94
Compare
d43fadf to
26f08fd
Compare
7adbc94 to
af95760
Compare
26f08fd to
074c632
Compare
af95760 to
9742ace
Compare
074c632 to
5181ae1
Compare
9742ace to
ed49647
Compare
5181ae1 to
f30994d
Compare
ed49647 to
90bee71
Compare
4a6a127 to
df988fb
Compare
90bee71 to
0ba3552
Compare
6c7af14 to
d7c16fa
Compare
joshlf
commented
Sep 10, 2023
68ab76d to
a3235fc
Compare
80c12cf to
2c9e7f1
Compare
a3235fc to
2d0bef3
Compare
2c9e7f1 to
bbf9603
Compare
9c77d7e to
f2e9656
Compare
joshlf
commented
Sep 12, 2023
Comment on lines
+22
to
+33
| //! - [`TryFromBytes`] supports non-`FromBytes` types by providing the ability | ||
| //! to check the validity of a conversion at runtime |
Member
Author
There was a problem hiding this comment.
I don't love this wording. @jswrenn any suggestions?
f2e9656 to
1244aba
Compare
joshlf
commented
Sep 12, 2023
Comment on lines
+1048
to
+1608
| /// # Panics | ||
| /// | ||
| /// `is_bit_valid` may panic. Callers are responsible for ensuring that any | ||
| /// `unsafe` code remains sound even in the face of `is_bit_valid` | ||
| /// panicking. (We support user-defined validation routines; so long as | ||
| /// these routines are not required to be `unsafe`, there is no way to | ||
| /// ensure that these do not generate panics.) |
Member
Author
There was a problem hiding this comment.
cc @jswrenn @djkoloski Calling this out; I've updated all the safety comments in this PR to address panics.
Base automatically changed from
try-from-bytes-raw-argument-to-is-bit-valid-2-validate-size-align
to
main
September 12, 2023 12:08
c79a650 to
778533a
Compare
baa448f to
73961ac
Compare
73961ac to
df96950
Compare
joshlf
commented
Nov 2, 2023
Comment on lines
+1723
to
+2148
| /// TODO(https://github.com/rust-lang/reference/pull/1401): Use `&u32` | ||
| /// instead once it's guaranteed that `align_of::<u32>() == | ||
| /// align_of::<char>()`. |
Member
Author
There was a problem hiding this comment.
This has landed; update this PR.
b69386f to
806a8d7
Compare
`TryFromBytes` can be implemented for types which are not `FromZeroes` or `FromBytes`; it supports performing a runtime check to determine whether a given byte sequence contains a valid instance of `Self`. This is the first step of #5. Future commits will add support for a custom derive and for implementing `TryFromBytes` on unsized types. TODO: - More thorough tests for non-FromBytes types (bool, char, etc) - Tests that go through the `TryFromBytes` public methods rather than testing `is_bit_valid` directly - Update safety requirements for `is_bit_valid` now that it takes a `Ptr` rather than a `NonNull` - Update SAFETY comments in various places Makes progress on #5
806a8d7 to
e54c8d6
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.
TryFromBytescan be implemented for types which are notFromZeroesorFromBytes; it supports performing a runtime check to determine whether a given byte sequence contains a valid instance ofSelf.This is the first step of #5. Future commits will add support for a custom derive and for implementing
TryFromByteson unsized types.Makes progress on #5