Skip to content

Fix unused_assignments false positives from macros - #149147

Merged
bors merged 1 commit into
rust-lang:mainfrom
chenyukang:yukang-fix-unused_assignments-macro-gen-147648
Dec 4, 2025
Merged

Fix unused_assignments false positives from macros#149147
bors merged 1 commit into
rust-lang:mainfrom
chenyukang:yukang-fix-unused_assignments-macro-gen-147648

Conversation

@chenyukang

@chenyukangchenyukang commented Nov 20, 2025

Copy link
Copy Markdown
Member

Fixes#147648

@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 20, 2025
@rustbot

Copy link
Copy Markdown
Collaborator

r? @SparrowLii

rustbot has assigned @SparrowLii.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Comment threadcompiler/rustc_mir_transform/src/liveness.rs Outdated
@chenyukang
chenyukangforce-pushed the yukang-fix-unused_assignments-macro-gen-147648 branch from 0f7c6a0 to c21d817CompareNovember 21, 2025 03:58
@rust-log-analyzer

This comment has been minimized.

@chenyukang
chenyukangforce-pushed the yukang-fix-unused_assignments-macro-gen-147648 branch from c21d817 to f943606CompareNovember 21, 2025 04:20
@workingjubilee

Copy link
Copy Markdown
Member

r? compiler

@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors r+ rollup

@bors

bors commented Dec 3, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit f943606 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 3, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Dec 4, 2025
…nments-macro-gen-147648, r=JonathanBrouwer
Fix unused_assignments false positives from macros
Fixesrust-lang#147648
Zalathar added a commit to Zalathar/rust that referenced this pull request Dec 4, 2025
…nments-macro-gen-147648, r=JonathanBrouwer
Fix unused_assignments false positives from macros
Fixesrust-lang#147648
@ZalatharZalathar mentioned this pull request Dec 4, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 4, 2025
…nments-macro-gen-147648, r=JonathanBrouwer
Fix unused_assignments false positives from macros
Fixesrust-lang#147648
This was referenced Dec 4, 2025
bors added a commit that referenced this pull request Dec 4, 2025
Rollup of 12 pull requests
Successful merges:
- #147841 (Fix ICE when applying test macro to crate root)
- #149147 (Fix unused_assignments false positives from macros)
- #149183 (Use `TypingMode::PostAnalysis` in `try_evaluate_const`)
- #149456 (std: don't call `current_os_id` from signal handler)
- #149501 (CTFE: avoid emitting a hard error on generic normalization failures)
- #149528 (reword error for invalid range patterns)
- #149539 (Additional test for uN::{gather,scatter}_bits)
- #149549 (Regression test for system register `ttbr0_el2`)
- #149550 (Disable native-lib for x check miri)
- #149554 (build-manifest: generate MSI and MINGW arrays from rustc)
- #149557 (c-variadic: bpf and spirv do not support c-variadic definitions)
- #149569 (Fix mailmap issue)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 82a17b3 into rust-lang:mainDec 4, 2025
11 checks passed
@rustbotrustbot added this to the 1.93.0 milestone Dec 4, 2025
rust-timer added a commit that referenced this pull request Dec 4, 2025
Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer
Fix unused_assignments false positives from macros
Fixes#147648
@Kobzol

Copy link
Copy Markdown
Member

@rust-timer build 4da4cc5

For #149631 (comment).

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (4da4cc5): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
7.4%[0.1%, 25.0%]10
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.0%[-0.0%, -0.0%]1
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -1.0%, secondary 11.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
14.4%[10.4%, 19.2%]4
Improvements ✅
(primary)
-1.0%[-1.0%, -1.0%]1
Improvements ✅
(secondary)
-2.2%[-2.2%, -2.2%]1
All ❌✅ (primary)-1.0%[-1.0%, -1.0%]1

Cycles

Results (secondary 23.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
23.6%[4.3%, 40.2%]4
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 468.789s -> 468.96s (0.04%)
Artifact size: 386.75 MiB -> 386.76 MiB (0.00%)

@rustbotrustbot added the perf-regression Performance regression. label Dec 4, 2025
@JonathanBrouwer

Copy link
Copy Markdown
Member

Oh wow I did not expect that regression from such a simple check.
Is .in_external_macro a slow check?
@chenyukang Do you have the time to look into this?

@workingjubilee

Copy link
Copy Markdown
Member

I'm expecting the answer to be "no" but I want to be sure we're confirming that answer given this is a beta regression:

@rustbot label +beta-nominated

@rustbotrustbot added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Dec 4, 2025
Kobzol added a commit to Kobzol/rust that referenced this pull request Dec 4, 2025
…ed_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b3, reversing
changes made to 5019bda.
@Kobzol

Copy link
Copy Markdown
Member

Posted a revert in #149657.

rust-borsBot added a commit that referenced this pull request Dec 4, 2025
Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
@chenyukang

Copy link
Copy Markdown
MemberAuthor

I'm on travel right now, will have a check it later.
seems the new testing code is on a hot path.

bors added a commit that referenced this pull request Dec 6, 2025
Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b3, reversing
changes made to 5019bda.
Reverts #149147 due to a [perf regression](#149147 (comment)).
bors added a commit that referenced this pull request Dec 7, 2025
Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b3, reversing
changes made to 5019bda.
Reverts #149147 due to a [perf regression](#149147 (comment)).
bors added a commit that referenced this pull request Dec 7, 2025
Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b3, reversing
changes made to 5019bda.
Reverts #149147 due to a [perf regression](#149147 (comment)).
@apiraino

Copy link
Copy Markdown
Contributor

Beta backport declined as per discussion on Zulip.

@rustbot label -beta-nominated

@rustbotrustbot removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Dec 8, 2025
github-actionsBot pushed a commit to rust-lang/miri that referenced this pull request Dec 11, 2025
Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b30d8cd379a43c3ee8d12598e89e3be0fbd, reversing
changes made to 5019bdaefeebecac42b778ae98def56cab69ab30.
Reverts rust-lang/rust#149147 due to a [perf regression](rust-lang/rust#149147 (comment)).
github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Dec 13, 2025
Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b30d8cd379a43c3ee8d12598e89e3be0fbd, reversing
changes made to 5019bdaefeebecac42b778ae98def56cab69ab30.
Reverts rust-lang/rust#149147 due to a [perf regression](rust-lang/rust#149147 (comment)).
github-actionsBot pushed a commit to rust-lang/rust-analyzer that referenced this pull request Dec 15, 2025
Rollup of 12 pull requests
Successful merges:
- rust-lang/rust#147841 (Fix ICE when applying test macro to crate root)
- rust-lang/rust#149147 (Fix unused_assignments false positives from macros)
- rust-lang/rust#149183 (Use `TypingMode::PostAnalysis` in `try_evaluate_const`)
- rust-lang/rust#149456 (std: don't call `current_os_id` from signal handler)
- rust-lang/rust#149501 (CTFE: avoid emitting a hard error on generic normalization failures)
- rust-lang/rust#149528 (reword error for invalid range patterns)
- rust-lang/rust#149539 (Additional test for uN::{gather,scatter}_bits)
- rust-lang/rust#149549 (Regression test for system register `ttbr0_el2`)
- rust-lang/rust#149550 (Disable native-lib for x check miri)
- rust-lang/rust#149554 (build-manifest: generate MSI and MINGW arrays from rustc)
- rust-lang/rust#149557 (c-variadic: bpf and spirv do not support c-variadic definitions)
- rust-lang/rust#149569 (Fix mailmap issue)
r? `@ghost`
`@rustbot` modify labels: rollup
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Dec 16, 2025
Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b30d8cd379a43c3ee8d12598e89e3be0fbd, reversing
changes made to 5019bdaefeebecac42b778ae98def56cab69ab30.
Reverts rust-lang/rust#149147 due to a [perf regression](rust-lang/rust#149147 (comment)).
makai410 pushed a commit to makai410/rust that referenced this pull request Dec 16, 2025
Revert "Rollup merge of rust-lang#149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b3, reversing
changes made to 5019bda.
Reverts rust-lang#149147 due to a [perf regression](rust-lang#149147 (comment)).
Kobzol pushed a commit to Kobzol/rustc_codegen_gcc that referenced this pull request Dec 21, 2025
Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b30d8cd379a43c3ee8d12598e89e3be0fbd, reversing
changes made to 5019bdaefeebecac42b778ae98def56cab69ab30.
Reverts rust-lang/rust#149147 due to a [perf regression](rust-lang/rust#149147 (comment)).
Kobzol pushed a commit to Kobzol/rustc_codegen_cranelift that referenced this pull request Dec 29, 2025
Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b30d8cd379a43c3ee8d12598e89e3be0fbd, reversing
changes made to 5019bdaefeebecac42b778ae98def56cab69ab30.
Reverts rust-lang/rust#149147 due to a [perf regression](rust-lang/rust#149147 (comment)).
cuviper pushed a commit to cuviper/rust that referenced this pull request Jan 9, 2026
…ed_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b3, reversing
changes made to 5019bda.
(cherry picked from commit 7438715)
@cuvipercuviper mentioned this pull request Jan 9, 2026
rust-borsBot added a commit that referenced this pull request Jan 9, 2026
[beta] backports
- Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer" #149657
- Don't lint on interior mutable `const` item coming from derefs #150166
- stdarch subtree update #150639 (partial)
r? cuviper
rust-borsBot added a commit that referenced this pull request Jan 9, 2026
[beta] backports
- Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer" #149657
- Don't lint on interior mutable `const` item coming from derefs #150166
- stdarch subtree update #150639 (partial)
- Update bors configuration #150308
- Update bors e-mail lookup #150783
- Make verify-channel.sh script compatible with new bors #150759
r? cuviper
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b30d8cd379a43c3ee8d12598e89e3be0fbd, reversing
changes made to 5019bdaefeebecac42b778ae98def56cab69ab30.
Reverts rust-lang/rust#149147 due to a [perf regression](rust-lang/rust#149147 (comment)).
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 27, 2026
Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b30d8cd379a43c3ee8d12598e89e3be0fbd, reversing
changes made to 5019bdaefeebecac42b778ae98def56cab69ab30.
Reverts rust-lang/rust#149147 due to a [perf regression](rust-lang/rust#149147 (comment)).
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regressionPerformance regression.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nightly unused_assignments false positives for miette::Diagnostic fields

11 participants

@chenyukang@rustbot@rust-log-analyzer@workingjubilee@JonathanBrouwer@bors@Kobzol@rust-timer@apiraino@cjgillot@SparrowLii