internal: init: implement automated field usage scanning#106
internal: init: implement automated field usage scanning#106Jkhall81 wants to merge 1 commit intoRust-for-Linux:mainfrom
Conversation
Signed-off-by: jkhall81 <jason.kei.hall@gmail.com>
6ed15b4 to
bc2e3f0
Compare
|
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 |
|
Hey! Sorry for the wait, thanks for the PR! 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:
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! |
Summary
Automatically scans the initializer to see which fields are actually used, preventing errors on packed structs.
Closes #98