-
-
Notifications
You must be signed in to change notification settings - Fork 19
Can bypass repr(packed) checking by using --cap-lints #26
Copy link
Copy link
Closed
Labels
C-bugCategory: related to a bug.Category: related to a bug.C-upstream-bugCategory: This is a bug of compiler or dependencies (the fix may require action in the upstream)Category: This is a bug of compiler or dependencies (the fix may require action in the upstream)I-unsoundA soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessA soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
Metadata
Metadata
Assignees
Labels
C-bugCategory: related to a bug.Category: related to a bug.C-upstream-bugCategory: This is a bug of compiler or dependencies (the fix may require action in the upstream)Category: This is a bug of compiler or dependencies (the fix may require action in the upstream)I-unsoundA soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessA soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
NOTE: pin-project (not lite) is not affected by this issue. see taiki-e/pin-project#34 (comment) for more.EDIT: see taiki-e/pin-project#342 for pin-project (not lite)
Currently, pin-project-lite uses
safe_packed_borrowlint to check that the struct is notrepr(packed). Unfortunately,safe_packed_borrowis lint and you can use the rustc's--cap-lintsflag to lower the lint cap level: https://godbolt.org/z/jEf1fGThe current pin-project-lite generates almost the same code as pin-project, but does not have the equivalent of the
repr(packed)checking that proc-macro(pin-project) does during expansion. (Since the proc-macro-attribute used on the struct expand later than declarative macro used for the struct, a complete fix for the problem is probably impossible untilsafe_packed_borrowgets a hard error.)