Fix #[expect(dead_code)] liveness propagation#154377
Fix #[expect(dead_code)] liveness propagation#154377rust-bors[bot] merged 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 |
|
See #152370 (comment) . |
|
Test cases look good here. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
@rustbot reroll |
|
r? TaKO8Ki @bors r+ rollup |
…TaKO8Ki Fix `#[expect(dead_code)]` liveness propagation Fixes rust-lang#154324 Fixes rust-lang#152370 (cc @eggyal) Previously, when traversing from a `ComesFromAllowExpect::Yes` item (i.e., with `#[allow(dead_code)]` or `#[expect(dead_code)]`), other `ComesFromAllowExpect::Yes` items reached during propagation would be updated to `ComesFromAllowExpect::No` and inserted into `live_symbols`. That caused `dead_code` lint couldn't be emitted correctly. After this PR, `ComesFromAllowExpect::Yes` items no longer incorrectly update other `ComesFromAllowExpect::Yes` items during propagation or mark them live by mistake, then `dead_code` lint could behave as expected.
…TaKO8Ki Fix `#[expect(dead_code)]` liveness propagation Fixes rust-lang#154324 Fixes rust-lang#152370 (cc @eggyal) Previously, when traversing from a `ComesFromAllowExpect::Yes` item (i.e., with `#[allow(dead_code)]` or `#[expect(dead_code)]`), other `ComesFromAllowExpect::Yes` items reached during propagation would be updated to `ComesFromAllowExpect::No` and inserted into `live_symbols`. That caused `dead_code` lint couldn't be emitted correctly. After this PR, `ComesFromAllowExpect::Yes` items no longer incorrectly update other `ComesFromAllowExpect::Yes` items during propagation or mark them live by mistake, then `dead_code` lint could behave as expected.
…TaKO8Ki Fix `#[expect(dead_code)]` liveness propagation Fixes rust-lang#154324 Fixes rust-lang#152370 (cc @eggyal) Previously, when traversing from a `ComesFromAllowExpect::Yes` item (i.e., with `#[allow(dead_code)]` or `#[expect(dead_code)]`), other `ComesFromAllowExpect::Yes` items reached during propagation would be updated to `ComesFromAllowExpect::No` and inserted into `live_symbols`. That caused `dead_code` lint couldn't be emitted correctly. After this PR, `ComesFromAllowExpect::Yes` items no longer incorrectly update other `ComesFromAllowExpect::Yes` items during propagation or mark them live by mistake, then `dead_code` lint could behave as expected.
Rollup of 6 pull requests Successful merges: - #155028 (tests: add whitespace tests for vertical tab behavior) - #155582 (Rewrite `FlatMapInPlace`.) - #151194 (Fix wrong suggestion for returning async closure) - #154377 (Fix `#[expect(dead_code)]` liveness propagation) - #155572 (Move diagnostic attribute target checks from check_attr) - #155586 (Ensure we don't feed owners from ast lowering if we ever make that query tracked)
Rollup merge of #154377 - mu001999-contrib:fix/dead-code, r=TaKO8Ki Fix `#[expect(dead_code)]` liveness propagation Fixes #154324 Fixes #152370 (cc @eggyal) Previously, when traversing from a `ComesFromAllowExpect::Yes` item (i.e., with `#[allow(dead_code)]` or `#[expect(dead_code)]`), other `ComesFromAllowExpect::Yes` items reached during propagation would be updated to `ComesFromAllowExpect::No` and inserted into `live_symbols`. That caused `dead_code` lint couldn't be emitted correctly. After this PR, `ComesFromAllowExpect::Yes` items no longer incorrectly update other `ComesFromAllowExpect::Yes` items during propagation or mark them live by mistake, then `dead_code` lint could behave as expected.
|
@rust-timer build 40d0e95 |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (40d0e95): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 0.1%, secondary 3.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.8%, secondary 5.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 492.256s -> 491.986s (-0.05%) |
|
Looks like this caused some regressions, including outside incremental scenarios. I think since it's a correctness fix it's probably acceptable, marking as triaged. I suspect most of the regressions are predominantly just in instruction count based on the changes -- since we're moving slightly larger structs around that'll take a few extra instructions -- but that shouldn't take meaningfully more wall time, which aligns with minimal cycle count changes. |
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.