Skip to content

Rustfmt now support use closures#139692

Draft
spastorino wants to merge 1 commit intorust-lang:mainfrom
spastorino:do-not-rustfmt-ignore
Draft

Rustfmt now support use closures#139692
spastorino wants to merge 1 commit intorust-lang:mainfrom
spastorino:do-not-rustfmt-ignore

Conversation

@spastorino
Copy link
Member

This should be merged when rust-lang/rustfmt#6532 is used by CI's rustfmt.

@rustbot
Copy link
Collaborator

rustbot commented Apr 11, 2025

r? @Mark-Simulacrum

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

@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 11, 2025
@rust-log-analyzer

This comment has been minimized.

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 19, 2025
@spastorino spastorino force-pushed the do-not-rustfmt-ignore branch from 6a3d3fe to 4781ecd Compare April 23, 2025 20:30
@rust-log-analyzer

This comment has been minimized.

@spastorino spastorino force-pushed the do-not-rustfmt-ignore branch from 4781ecd to 7b9072d Compare May 15, 2025 19:43
@rust-log-analyzer

This comment has been minimized.

@spastorino spastorino force-pushed the do-not-rustfmt-ignore branch from 7b9072d to 6c3e13e Compare July 2, 2025 15:50
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jul 22, 2025

☔ The latest upstream changes (presumably #144249) made this pull request unmergeable. Please resolve the merge conflicts.

@spastorino spastorino added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 2, 2025
@spastorino
Copy link
Member Author

This is waiting on an update to src/tools/rustfmt.

@spastorino spastorino force-pushed the do-not-rustfmt-ignore branch from 6c3e13e to 1bf5fa9 Compare December 3, 2025 14:36
@rust-log-analyzer
Copy link
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[TIMING:end] tool::ToolBuild { build_compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 11.689
[TIMING:end] tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/tests/mir-opt/ergonomic-clones/closure.rs:10:
     // CHECK-NOT: <String as Clone>::clone
     let s = String::from("hi");
 
-    let cl = use || s;
+    let cl = || s;
     cl()
 }
 
Diff in /checkout/tests/mir-opt/ergonomic-clones/closure.rs:24:
     // CHECK: <Foo as Clone>::clone
     let f = Foo;
 
-    let f1 = use || f;
+    let f1 = || f;
 
-    let f2 = use || f;
+    let f2 = || f;
 
     f
 }
Diff in /checkout/tests/mir-opt/ergonomic-clones/closure.rs:37:
     // CHECK-NOT: <i32 as Clone>::clone
---
 
     i
 }
Diff in /checkout/tests/mir-opt/ergonomic-clones/closure.rs:47:
 pub fn ergonomic_clone_closure_use_cloned_generics<T: UseCloned>(f: T) -> T {
     // CHECK-LABEL: fn ergonomic_clone_closure_use_cloned_generics(
     // CHECK: <T as Clone>::clone
-    let f1 = use || f;
+    let f1 = || f;
 
-    let f2 = use || f;
+    let f2 = || f;
 
     f
 }
Diff in /checkout/tests/codegen-llvm/ergonomic-clones/closure.rs:1:
 //@ compile-flags: -C no-prepopulate-passes -Copt-level=0 -Zmir-opt-level=0
 
 #![crate_type = "lib"]
-
 #![feature(ergonomic_clones)]
 #![allow(incomplete_features)]
 
Diff in /checkout/tests/codegen-llvm/ergonomic-clones/closure.rs:11:
     let s = String::from("hi");
 
     // CHECK-NOT: ; call core::clone::impls::<impl core::clone::Clone for String>::clone
-    let cl = use || s;
+    let cl = || s;
     cl()
 }
 
Diff in /checkout/tests/codegen-llvm/ergonomic-clones/closure.rs:24:
     let f = Foo;
 
     // CHECK: ; call <closure::Foo as core::clone::Clone>::clone
-    let f1 = use || f;
+    let f1 = || f;
 
     // CHECK: ; call <closure::Foo as core::clone::Clone>::clone
-    let f2 = use || f;
+    let f2 = || f;
 
     f
 }
Diff in /checkout/tests/codegen-llvm/ergonomic-clones/closure.rs:36:
     let i = 1;
---
     i
 }
Diff in /checkout/tests/codegen-llvm/ergonomic-clones/closure.rs:46:
 
 pub fn ergonomic_clone_closure_use_cloned_generics<T: UseCloned>(f: T) -> T {
     // CHECK-NOT: ; call core::clone::impls::<impl core::clone::Clone for i32>::clone
-    let f1 = use || f;
+    let f1 = || f;
 
     // CHECK-NOT: ; call core::clone::impls::<impl core::clone::Clone for i32>::clone
-    let f2 = use || f;
+    let f2 = || f;
 
     f
 }
fmt: checked 6589 files
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`

@spastorino
Copy link
Member Author

spastorino commented Mar 1, 2026

This needs rustfmt >= 2026-02-28, as soon as we have this version running we can rebase and merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-meta Area: Issues & PRs about the rust-lang/rust repository itself S-blocked Status: Blocked on something else such as an RFC or other implementation work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants