# \[Pitch\] Noncopyable (or "move-only") structs and enums

**URL:** <https://forums.swift.org/t/pitch-noncopyable-or-move-only-structs-and-enums/61903>\
**Category:** Pitches\
**Created:** [December 7, 2022, 7:52pm UTC](https://forums.swift.org/t/pitch-noncopyable-or-move-only-structs-and-enums/61903 "2022-12-07T19:52:38Z")\
**Posts on this page:** 1\
**Showing post:** 27

<div class="post-metadata">

**Author:** ![Joe\_Groff](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/joe_groff/32/1929_2.png) [@Joe\_Groff](https://forums.swift.org/u/Joe_Groff)\
**Post date:** [December 8, 2022, 5:34pm UTC](https://forums.swift.org/t/pitch-noncopyable-or-move-only-structs-and-enums/61903/27 "2022-12-08T17:34:06Z")

</div>

> [@ksluder](#):
>
> That’s precisely what I would want the `@noncopyable` attribute to do: prevent `var x = MyNonCopyable(); let y = x`.

I presume `MyNonCopyable()` is concretely a non-copyable type, so `let y = x` would in fact move `x` into `y` rather than copy it. When we generalize the generics system to include noncopyable types, then `withHandle` can't assume `Handle` is copyable, and it would act as a noncopyable type within the body of the function. So the function would not be able to introduce copies of whatever `Handle` is, but callers can still pass in copyable types for the `Handle` that they can copy themselves.

You may also be interested in [the `@noImplicitCopy` attribute](https://forums.swift.org/t/pitch-noimplicitcopy-attribute-for-local-variables-and-function-parameters/61506/11), which we're implementing to suppress implicit copying on values that are of copyable type.

---

_[View the full topic](https://forums.swift.org/t/pitch-noncopyable-or-move-only-structs-and-enums/61903)._
