Hello!
I'm learning Rust, and for some reason I decided to try to port a 2048 AI to Rust. Here is the branch: GitHub - mdesantis/2048-ai at rust-bindgen
I managed to fix some easy errors, but now I'm stuck with the following errors:
- error[E0277]: arrays only have std trait implementations for lengths 0..=32
- error[E0277]: the trait bound
[u8; 44]: std::default::Default
is not satisfied - error[E0277]: the trait bound
[u8; 44]: std::default::Default
is not satisfied
I must say I'm noob with both Rust and C++, so I don't have much experience to help me with this.
Errors details
> cargo build --verbose
Fresh glob v0.3.0
Fresh cc v1.0.50
Fresh version_check v0.1.5
Fresh lazy_static v1.4.0
Fresh quick-error v1.2.3
Fresh unicode-width v0.1.7
Fresh cfg-if v0.1.10
Fresh unicode-xid v0.2.0
Fresh regex-syntax v0.6.13
Fresh termcolor v1.1.0
Fresh strsim v0.8.0
Fresh ansi_term v0.11.0
Fresh vec_map v0.8.1
Fresh lazycell v1.2.1
Fresh peeking_take_while v0.1.2
Fresh shlex v0.1.1
Fresh thread_local v1.0.1
Fresh humantime v1.3.0
Fresh textwrap v0.11.0
Fresh libc v0.2.66
Fresh memchr v2.3.0
Fresh log v0.4.8
Fresh proc-macro2 v1.0.8
Fresh byteorder v1.3.2
Fresh bitflags v1.2.1
Fresh atty v0.2.14
Fresh aho-corasick v0.7.6
Fresh libloading v0.5.2
Fresh which v3.1.0
Fresh nom v4.2.3
Fresh rustc-hash v1.0.1
Fresh quote v1.0.2
Fresh regex v1.3.3
Fresh clap v2.33.0
Fresh clang-sys v0.28.1
Fresh cexpr v0.3.6
Fresh env_logger v0.7.1
Fresh bindgen v0.52.0
Compiling ai-2048 v0.1.0 (/home/maurizio/Sviluppo/2048-ai)
Running `rustc --edition=2018 --crate-name ai_2048 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=652adae31d2362c8 -C extra-filename=-652adae31d2362c8 --out-dir /home/maurizio/Sviluppo/2048-ai/target/debug/deps -C incremental=/home/maurizio/Sviluppo/2048-ai/target/debug/incremental -L dependency=/home/maurizio/Sviluppo/2048-ai/target/debug/deps`
error[E0277]: arrays only have std trait implementations for lengths 0..=32
--> /home/maurizio/Sviluppo/2048-ai/target/debug/build/ai-2048-d93bb4c666de3dc8/out/bindings.rs:6552:9
|
6552 | pub _bitfield_1: root::__BindgenBitfieldUnit<[u8; 44usize], u8>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[u8; 44]`
|
= note: required because of the requirements on the impl of `std::fmt::Debug` for `[u8; 44]`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `root::__BindgenBitfieldUnit<[u8; 44], u8>`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&root::__BindgenBitfieldUnit<[u8; 44], u8>`
= note: required for the cast to the object type `dyn std::fmt::Debug`
error[E0277]: the trait bound `[u8; 44]: std::default::Default` is not satisfied
--> /home/maurizio/Sviluppo/2048-ai/target/debug/build/ai-2048-d93bb4c666de3dc8/out/bindings.rs:6552:9
|
6552 | pub _bitfield_1: root::__BindgenBitfieldUnit<[u8; 44usize], u8>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::default::Default` is not implemented for `[u8; 44]`
|
= help: the following implementations were found:
<&[T] as std::default::Default>
<&mut [T] as std::default::Default>
<[T; 0] as std::default::Default>
<[T; 10] as std::default::Default>
and 31 others
= note: required because of the requirements on the impl of `std::default::Default` for `root::__BindgenBitfieldUnit<[u8; 44], u8>`
= note: required by `std::default::Default::default`
error[E0277]: the trait bound `[u8; 44]: std::default::Default` is not satisfied
--> /home/maurizio/Sviluppo/2048-ai/target/debug/build/ai-2048-d93bb4c666de3dc8/out/bindings.rs:6771:17
|
6771 | Default::default();
| ^^^^^^^^^^^^^^^^ the trait `std::default::Default` is not implemented for `[u8; 44]`
|
= help: the following implementations were found:
<&[T] as std::default::Default>
<&mut [T] as std::default::Default>
<[T; 0] as std::default::Default>
<[T; 10] as std::default::Default>
and 31 others
= note: required because of the requirements on the impl of `std::default::Default` for `root::__BindgenBitfieldUnit<[u8; 44], u8>`
= note: required by `std::default::Default::default`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
error: could not compile `ai-2048`.
Caused by:
process didn't exit successfully: `rustc --edition=2018 --crate-name ai_2048 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=652adae31d2362c8 -C extra-filename=-652adae31d2362c8 --out-dir /home/maurizio/Sviluppo/2048-ai/target/debug/deps -C incremental=/home/maurizio/Sviluppo/2048-ai/target/debug/incremental -L dependency=/home/maurizio/Sviluppo/2048-ai/target/debug/deps` (exit code: 1)