# Consider move() parameters with cloning

**URL:** <https://internals.rust-lang.org/t/consider-move-parameters-with-cloning/19713>\
**Category:** language design\
**Created:** [October 14, 2023, 3:53pm UTC](https://internals.rust-lang.org/t/consider-move-parameters-with-cloning/19713 "2023-10-14T15:53:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Subkey](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/subkey/32/11415_2.png) [@Subkey](https://internals.rust-lang.org/u/Subkey)\
**Post date:** [October 14, 2023, 3:53pm UTC](https://internals.rust-lang.org/t/consider-move-parameters-with-cloning/19713/1 "2023-10-14T15:53:41Z")

</div>

Every using with move, I've to use several `clone()`s and `let = `s for moving cursors into closure. I'm considering macros like `clone_for_moving!(var1,var2,var3; |param| { // body block });` but I have to write long macro names every time.

It's my idea to use `move(var1, var2, var3) || {}` to explicitly specify variables as cloned into closure, and it seems like an unccupied syntax.

---

<div class="post-metadata">

**Author:** ![kpreid](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kpreid/32/8484_2.png) [@kpreid](https://internals.rust-lang.org/u/kpreid)\
**Post date:** [October 14, 2023, 4:47pm UTC](https://internals.rust-lang.org/t/consider-move-parameters-with-cloning/19713/2 "2023-10-14T16:47:56Z")

</div>

Similar syntax is currently being discussed here:

> <https://github.com/rust-lang/rfcs/pull/3512>
>
> As per discussion in #2407, adds the \`move(y=f(x)) || {}\`/\`move(x) || {}\` syntax….
> 
> \[Rendered\](https://github.com/SOF3/rfcs/blob/closure-move-bindings/text/3512-closure-move-bindings.md)

In this proposal, the clones would be explicit, but still more concise than currently. It's unlikely that Rust will ever have fully implicit clones.

---

<div class="post-metadata">

**Author:** ![quinedot](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/quinedot/32/7294_2.png) [@quinedot](https://internals.rust-lang.org/u/quinedot)\
**Post date:** [October 14, 2023, 5:57pm UTC](https://internals.rust-lang.org/t/consider-move-parameters-with-cloning/19713/3 "2023-10-14T17:57:41Z")

</div>

Search for "clone closure" to find some prior discussions.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [January 12, 2024, 5:58pm UTC](https://internals.rust-lang.org/t/consider-move-parameters-with-cloning/19713/4 "2024-01-12T17:58:29Z")

</div>

Closed on January 12, 2024, 5:58pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
