Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust: Creating a large tuple results in error, as large tuples do not implement fmt::Debug #1096

Open
sfulham opened this issue Nov 24, 2024 · 1 comment

Comments

@sfulham
Copy link

sfulham commented Nov 24, 2024

When using a tuple as a fixed length array (in my case for the purposes of storing a UUID in a 16-byte buffer) results in the following error:

error[E0277]: `(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8)` doesn't implement `Debug`
  --> src/bindings.rs:69:39
   |
69 |                         .field("key", &self.key)
   |                                       ^^^^^^^^^ `(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8)` cannot be formatted using `{:?}` because it doesn't implement `Debug`
   |
   = help: the trait `Debug` is not implemented for `(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8)`
   = help: the following other types implement trait `Debug`:
             ()
             (A, Z, Y, X, W, V, U, T)
             (B, A, Z, Y, X, W, V, U, T)
             (C, B, A, Z, Y, X, W, V, U, T)
             (D, C, B, A, Z, Y, X, W, V, U, T)
             (E, D, C, B, A, Z, Y, X, W, V, U, T)
             (T,)
             (U, T)
           and 5 others
   = note: required for the cast from `&(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8)` to `&dyn Debug

This could be fixed by implementing WebAssembly/component-model#384 and using list<u8,16> which could be stored in rust as [u8;16]

@pchickey
Copy link
Contributor

Thanks for your report. As a workaround until this is solved, can you define your uuid as a record instead of a tuple?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants