rust-console / gba

A crate that helps you make GBA games
https://docs.rs/gba
Apache License 2.0
658 stars 50 forks source link

Incorrect example code in docs for art::CGA_8X8_THICK #154

Closed ash2x3zb9cy closed 3 years ago

ash2x3zb9cy commented 3 years ago

Two compile errors occur when using the example code from that page.

error[E0308]: mismatched types
  --> src\main.rs:23:32
   |
23 |         source_data_len_bytes: size_of_val(&CGA_8X8_THICK) as usize,
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `usize`

error[E0308]: mismatched types
  --> src\main.rs:30:24
   |
30 |     unsafe { BitUnPack(CGA_8X8_THICK.as_ptr(), 0x0600_0000 as *mut u32, &info) };
   |                        ^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `u32`
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const u32`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `g-major` due to 2 previous errors

The first error can be silenced by changing the cast to as u16, though I do not know if this is a correct change.

Lokathor commented 3 years ago

Should be fixed by https://github.com/rust-console/gba/commit/b93589b8acad52fc0248b2b433302c1f658f6d54