Fix #[expect(dead_code)] liveness propagation#154377
Fix #[expect(dead_code)] liveness propagation#154377mu001999 wants to merge 1 commit intorust-lang:mainfrom
#[expect(dead_code)] liveness propagation#154377Conversation
|
r? @TaKO8Ki rustbot has assigned @TaKO8Ki. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@rustbot author I realized that this would fail during secondary propagation. This still needs to be revised a bit. |
|
Reminder, once the PR becomes ready for a review, use |
|
oops, forgot to update the label @rustbot ready |
| No, | ||
| } | ||
|
|
||
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] |
There was a problem hiding this comment.
Nit: I found this struct hard to understand, I think a doc comment that explains the role of these fields in terms of examples would be very helpful to future code readers :)
There was a problem hiding this comment.
Added, could you review this again? :)
|
See #152370 (comment) . |
|
Test cases look good here. |
Fixes #154324
Fixes #152370 (cc @eggyal)
Previously, when traversing from a
ComesFromAllowExpect::Yesitem (i.e., with#[allow(dead_code)]or#[expect(dead_code)]), otherComesFromAllowExpect::Yesitems reached during propagation would be updated toComesFromAllowExpect::Noand inserted intolive_symbols. That causeddead_codelint couldn't be emitted correctly.After this PR,
ComesFromAllowExpect::Yesitems no longer incorrectly update otherComesFromAllowExpect::Yesitems during propagation or mark them live by mistake, thendead_codelint could behave as expected.