# Pre-RFC: Copy-like trait for large types

**URL:** <https://internals.rust-lang.org/t/pre-rfc-copy-like-trait-for-large-types/11852>\
**Category:** language design\
**Created:** [February 18, 2020, 5:29pm UTC](https://internals.rust-lang.org/t/pre-rfc-copy-like-trait-for-large-types/11852 "2020-02-18T17:29:41Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![nikomatsakis](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/nikomatsakis/32/5410_2.png) [@nikomatsakis](https://internals.rust-lang.org/u/nikomatsakis)\
**Post date:** [February 26, 2020, 1:49pm UTC](https://internals.rust-lang.org/t/pre-rfc-copy-like-trait-for-large-types/11852/21 "2020-02-26T13:49:43Z")

</div>

When we've discussed this in the past, we came to the conclusion that we should encourage the `Copy` trait to be more widely used, but to use a lint to guard against unexpected copies. This could be either because the value is large or because it contains interior mutability.

I remember that we made _some_ decision in the iterator design that really encouraged the above approach, but I can't quite remember what it was (i.e., there was some point where we said "if we were going to have two traits, we would do it this way, but if we're only going to have one, we would do it _that_ way" -- and we did it _that_ way).

There is an open Rust issue on exploring this topic, [#45683](https://github.com/rust-lang/rust/issues/45683), as well.

---

<div class="post-metadata">

**Author:** ![skade](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/skade/32/3333_2.png) [@skade](https://internals.rust-lang.org/u/skade)\
**Post date:** [March 1, 2020, 8:43am UTC](https://internals.rust-lang.org/t/pre-rfc-copy-like-trait-for-large-types/11852/22 "2020-03-01T08:43:09Z")

</div>

One thing that has not come up yet in this topic is that `Copy` is useful for collections, independent of the size of `T`, for example in [copy\_from\_slice](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.copy_from_slice).

Bringing a third trait into play would make those interfaces much harder.

It's only the places where "Copy or Reference" is a decision where that is a concern. There are other places where `Copy` matters.

---

<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:** [May 30, 2020, 8:43am UTC](https://internals.rust-lang.org/t/pre-rfc-copy-like-trait-for-large-types/11852/23 "2020-05-30T08:43:10Z")

</div>

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

[Previous page](https://internals.rust-lang.org/t/pre-rfc-copy-like-trait-for-large-types/11852.md?page=1)
