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
I came across impl_stable_hash_via_hash!() the other day and it seems very problematic because one can easily generate invalid HashStable implementations without even noticing:
#[derive(Hash)]structFoo<'tcx>{def_id:DefId,// numeric value of def_id ends up in fingerprint,ptr:*constc_void,// memory address ends up in fingerprint,bar:Interned<'tcx,Bar>,// ditto}// Yay, three separate bugs in a single line!impl_stable_hash_via_hash!(Foo);
I think we should just remove the macro (or keep it local to the module that implements HashStable for basic types). #[derive(HashStable_Generic)] is available as a safe alternative.
rustc_lint_defs::Level looks like a case where this is already a problem because of the HirId in the contained LintExpectationId.
Activity
michaelwoerister commentedon Apr 13, 2022
I plan to fix this on Friday if nobody beats me to it.