Previously missing derive(Copy) on an UDT enum integer shows up as a cryptic error way down the stack (the contract itself will compile just fine, you get the following error when trying to compile code (e.g. a native unit test) using the generated contract client):
error[E0507]: cannot move out of `*self` which is behind a shared reference
--> tests/udt_enum/src/lib.rs:4:1
|
4 | #[contracttype]
| ^^^^^^^^^^^^^^^ move occurs because `*self` has type `UdtEnum`, which does not implement the `Copy` trait
|
= note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info)
This change gives a clear error message during contract macro expansion (before compile time):
error: enum integer UdtEnum must have `derive(Copy)`
--> tests/udt_enum/src/lib.rs:6:10
|
6 | pub enum UdtEnum {
| ^^^^^^^
What
Resolves https://github.com/stellar/rs-soroban-sdk/issues/630
Why
Previously missing
derive(Copy)
on an UDT enum integer shows up as a cryptic error way down the stack (the contract itself will compile just fine, you get the following error when trying to compile code (e.g. a native unit test) using the generated contract client):This change gives a clear error message during contract macro expansion (before compile time):
Known limitations
[TODO or N/A]