Skip to content

ergonomic_clones use doesn't seem to work #6596

Open
@spastorino

Description

@spastorino

Given:

#![feature(ergonomic_clones)]

struct Foo;

impl UseCloned for Foo {}

fn main() {
    let f = Foo;

    use || f
}

Here is what happens:

[santiago@galago myapp (master)]$ rustfmt --version
rustfmt 1.8.0-nightly (71e4c005ca 2025-07-01)
[santiago@galago myapp (master)]$ rustfmt --edition 2024 src/main.rs
[santiago@galago myapp (master)]$ git diff
diff --git a/src/main.rs b/src/main.rs
index 910ade0..7bb2e38 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -7,5 +7,5 @@ impl UseCloned for Foo {}
 fn main() {
     let f = Foo;

-    use || f
+    || f
 }

I'm not really sure what's going on as there's this PR #6532 which contains a test that seems to be testing this.

cc @ytmimi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions