Conversation
teohhanhui
reviewed
Mar 22, 2025
src/lib.rs
Outdated
| $crate::NonEmpty { | ||
| head: $h, | ||
| tail: alloc::vec::Vec::new(), | ||
| tail: vec![], |
There was a problem hiding this comment.
This runs into issues with macro hygiene:
- https://doc.rust-lang.org/reference/macros-by-example.html#hygiene
- https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene.html
It would have to be something like $crate::__macro_support::vec instead.
See e.g. tokio-rs/tracing#1918
|
Would it be possible to merge this soon? Getting a fix to #68 would be much appreciated! |
It was a misnomer to name the feature flag `bincode2` since that is the name of unmaintained library. The library `bincode` is actively maintained, so the feature flag is named after it instead. There is a proper version release v2.0.1 now, which is specified instead. The derive is cleaned up, and there is a roundtrip test added.
As pointed out[^0], `nonempty!` runs into macro hygiene issues. Use the same approach as tracing[^1] to re-export the `vec!` macro and qualify it using the `$crate` syntax. [^0]: #70 (comment) [^1]: https://github.com/tokio-rs/tracing/blob/e63ef57f3d686abe3727ddd586eb9af73d6715b7/tracing/src/lib.rs#L987
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This was referenced Jul 19, 2025
Closed
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.
Currently includes #69