Hi
I was trying out the following code and ran into an error.
fn main() {
let a = [12;500];
let b = [15;5];
println!("{:?}",a );
println!("{:?}",b );
}
error[E0277]: the trait bound `[{integer}; 500]: std::fmt::Debug` is not
satisfied
--> src\main.rs:37:17
|
37 | println!("{:?}",a );
| ^ `[{integer}; 500]` cannot be formatted using `:?`; if it
is defined in your crate, add `#[derive(Debug)]` or manually implement it
|
= help: the trait `std::fmt::Debug` is not implemented for `[{integer}; 500]`
= note: required by `std::fmt::Debug::fmt`
>From https://doc.rust-lang.org/std/primitive.array.html
This limitation on the size N exists because Rust does not yet support code
that is generic over the size of an array type. [Foo; 3] and [Bar; 3] are
instances of same generic type [T; 3], but [Foo; 3] and [Foo; 5] are entirely
different types. As a stopgap, trait implementations are statically generated
up to size 32.
Could anyone please shed some light on this concept/limitation, I cant wrap my
head around this.
--
https://meetup.com/rustox
---
You received this message because you are subscribed to the Google Groups "Rust
Bangalore Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rustox.
To view this discussion on the web visit
https://groups.google.com/d/msgid/rustox/bd1d61d0-315b-4a6a-81b2-446280e97047%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.