borsh-rs icon indicating copy to clipboard operation
borsh-rs copied to clipboard

Failed to derive borsh ser/de in a recursive data structure

Open ailisp opened this issue 3 years ago • 1 comments

Minimal example:

#[derive(BorshSerialize, BorshDeserialize)]
enum A {
    X,
    Y(Box<A>),
}

gives compilation error:

error[E0275]: overflow evaluating the requirement `Box<A>: BorshSerialize`
 --> src/main.rs:3:10
  |
3 | #[derive(BorshSerialize, BorshDeserialize)]
  |          ^^^^^^^^^^^^^^
  |

ailisp avatar Jan 22 '21 17:01 ailisp

serde, can handle this case, btw

ailisp avatar Jan 22 '21 17:01 ailisp

Any plan to support this anytime soon?

vantessel avatar Feb 08 '23 17:02 vantessel

@vantessel I believe the original motivation died out and there is currently no champion to implement it. I am happy to review a PR if anyone is ready to contribute the implementation, just make sure you read the discussion in PR #96 that did not get through.

frol avatar Feb 08 '23 17:02 frol