Skip to content

Do not use desugared local names in tail_expr_drop_order diagnostics#157942

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
qaijuang:issue-136206-tail-expr-drop-order-awaitee
Jun 21, 2026
Merged

Do not use desugared local names in tail_expr_drop_order diagnostics#157942
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
qaijuang:issue-136206-tail-expr-drop-order-awaitee

Conversation

@qaijuang

@qaijuang qaijuang commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

tail_expr_drop_order labels values using names from body.var_debug_info.
That works for user-written bindings, but .await lowering also introduces a synthetic __awaitee binding for debuginfo. This can leak into the user-facing lint diagnostic.

This PR filters collected diagnostic names through LocalDecl::from_compiler_desugaring(), so compiler-generated locals fall back to the existing #N temporary labels. This does not change async lowering or the __awaitee debuginfo name itself.

A user-written binding named __awaitee is still treated as user-written and is still shown by name.

Fixes #136206

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 15, 2026
@qaijuang
qaijuang marked this pull request as ready for review June 16, 2026 00:25
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 16, 2026
@rustbot

rustbot commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 16, 2026
@rustbot

rustbot commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

r? @JonathanBrouwer

rustbot has assigned @JonathanBrouwer.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 21 candidates

@JonathanBrouwer JonathanBrouwer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors

rust-bors Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 8e3a32e has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Jun 21, 2026
rust-bors Bot pushed a commit that referenced this pull request Jun 21, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #155439 (Enable Cargo's new build-dir layout)
 - #157942 (Do not use desugared local names in tail_expr_drop_order diagnostics)
 - #158193 (Remove `has_delayed_lints` optimization)
 - #158204 (More general assert in Interner const fn check)
@rust-bors
rust-bors Bot merged commit c1c8864 into rust-lang:main Jun 21, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 21, 2026
rust-timer added a commit that referenced this pull request Jun 21, 2026
Rollup merge of #157942 - qaijuang:issue-136206-tail-expr-drop-order-awaitee, r=JonathanBrouwer

Do not use desugared local names in tail_expr_drop_order diagnostics

`tail_expr_drop_order` labels values using names from `body.var_debug_info`.
That works for user-written bindings, but `.await` lowering also introduces a synthetic `__awaitee` binding for debuginfo. This can leak into the user-facing lint diagnostic.

This PR filters collected diagnostic names through `LocalDecl::from_compiler_desugaring()`, so compiler-generated locals fall back to the existing `#N` temporary labels. This does not change async lowering or the `__awaitee` debuginfo name itself.

A user-written binding named `__awaitee` is still treated as user-written and is still shown by name.

Fixes #136206
@qaijuang
qaijuang deleted the issue-136206-tail-expr-drop-order-awaitee branch June 21, 2026 16:24
pull Bot pushed a commit to xtqqczze/rust-lang-miri that referenced this pull request Jun 22, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#155439 (Enable Cargo's new build-dir layout)
 - rust-lang/rust#157942 (Do not use desugared local names in tail_expr_drop_order diagnostics)
 - rust-lang/rust#158193 (Remove `has_delayed_lints` optimization)
 - rust-lang/rust#158204 (More general assert in Interner const fn check)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant 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.

tail_expr_drop_order lint can mention internal __awaitee name

3 participants