Why does destructuring assignment require ImplicitlyCopyable instead of Copyable?

Hello!

I’m new to Mojo and am working with a custom Point struct in Mojo and found that destructuring assignment only works when the struct conforms to ImplicitlyCopyable, not just Copyable.

Here’s my struct:

@fieldwise_init
struct Point[dtype: DType](Copyable, Writable) where dtype.is_numeric():
    comptime _coord_type = Scalar[Self.dtype]
    var x: Self._coord_type
    var y: Self._coord_type

With just Copyable, this doesn’t work:

    comptime point_type = Point[dtype=DType.float64]
    var p: point_type
    var p1: point_type
    var p2: point_type

    p, p1, p2 = point_type(10, 0), point_type(0, 100), point_type(0, 1)

And this works:

    p = point_type(10, 0)
    p1 = point_type(0, 100)
    p2 = point_type(0, 1)

But when I change it to ImplicitlyCopyable, destructuring assignment works as expected.

My question:
What’s the fundamental difference between Copyable and ImplicitlyCopyable that makes destructuring assignment require the latter?

I understand that Copyable allows explicit copying, but why does destructuring assignment specifically need implicit copying behavior? Is there a technical reason related to how the compiler handles the unpacking operation?

I’d like to understand the rationale behind this requirement to better know when to use each trait.

Thanks!


EDIT: I’m using Mojo version 1.2.0.

Following up on my own question - I got this answered elsewhere (with AI assistance). The answer turned out to be straightforward once you see the mechanism, but it wasn’t obvious to me from the docs, so I’m posting it here rather than letting it stay buried in a private chat - in case it helps the next person who searches for this.

Destructuring assignment like a, b = .. desugars to reference - returning subscripts on the Tuple: each element is accessed through a borrow, and materializing an owned value from a borrow requires the compiler to insert a copy implicitly.