Skip to content

Tweak closure string when using -Zspan_free_formats #144337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

estebank
Copy link
Contributor

Implementation of (an interpretation of) the proposed output in https://internals.rust-lang.org/t/post-0/23184 for closures.

For closures in the local crate, we look at where the closure comes from in order to give them a locally reasonable name:

  - closures assigned to binding `let a`, `{a}`
  - closures passed directly as arguments in function call,
    `{function_name#parameter_name_or_position}`
  - closures passed directly as arguments in method call,
    `{Trait::method#parameter_name_or_position}`
  - closures assigned to statics or consts, the item's name
  - closures returned from functions, methods and closures, `{return}`

Do not include implicit desugared closure from async fn in closure type path: async_fn_name instead of async_fn_name::{closure#0}.

estebank added 2 commits July 23, 2025 00:27
For closures in the local crate, we look at where the closure comes from in
order to give them a locally reasonable name:

  - closures assigned to binding `let a`, `{a}`
  - closures passed directly as arguments in function call,
    `{function_name#parameter_name_or_position}`
  - closures passed directly as arguments in method call,
    `{Trait::method#parameter_name_or_position}`
  - closures assigned to statics or consts, the item's name
  - closures returned from functions, methods and closures, `{return}`
@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 Jul 23, 2025
estebank added 2 commits July 23, 2025 18:01
Just to demonstrate what the new closure format would look like in all our tests.
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jul 23, 2025
@estebank estebank closed this Jul 23, 2025
@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 Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants