You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed the cargo fmt --check --all stuff, manually. I need to figure out how or make something to do that automatically. There was a ui test failure tests/ui/compile-fail/init/packed_struct.rs. That compiles now. So I deleted the .rs and .stderr for that. Now there is just this MSRV (1.78) issue. What I tried just now didn't fix it. I'll look at it in the morning.
The issue with 1.78 should be easily resolvible, since we merged #102, you might just need to enable the correct feature in the test.
As for the implementation itself, I'm not sure that we want to do it this way, because it will have both false positives and false negatives:
false positive: init!(Struct { field: field::new(), other: 42 }) where field also is a module.
false negative: init!(Struct { field: Field::new(), other: dma_read!(field) }) since macro token streams are skipped by visitors by default.
I'm not so sure if it's a good idea to create a very clever parser here to also avoid closure variables and other item definitions. (we wouldn't want a helper function declared inside of a code block that reuses a field name as a parameter to trigger it) I'll have to think a bit more about this.
I totally forgot to inform you about the fact that Gary found an unsoundness related to field accessors. I'm going to merge #111 soon -- the fix for the problem. It conflicts with this PR, since now guards are always required for soundness.
Sorry for the inconvenience and thanks for trying to improve pin-init!
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
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.
Summary
Automatically scans the initializer to see which fields are actually used, preventing errors on packed structs.
Closes#98