iliazeus / iso2god-rs

A command-line tool to convert Xbox 360 ISOs into a Games-On-Demand file format. For Linux, Windows and MacOS.
MIT License
77 stars 6 forks source link

Trying to build with Cargo #1

Closed agaripian closed 1 year ago

agaripian commented 1 year ago

Hi thanks for this repo/code, I am trying to build with cargo on ubuntu, I am a rust noob unfortunately. I had a few other errors so I updated to nightly version of rust which resolved those errors but now I am getting this error below when running cargo build.

rustc --version
rustc 1.69.0-nightly (c5c7d2b37 2023-02-24)
cargo --version
cargo 1.69.0-nightly (9d5b32f50 2023-02-22)
cannot move out of `self.content_type` which is behind a shared reference
  --> src/god/file_layout.rs:35:37
   |
35 |             .join(format!("{:08X}", self.content_type as u32))
   |                                     ^^^^^^^^^^^^^^^^^ move occurs because `self.content_type` has type `con_header::ContentType`, which does not implement the `Copy` trait

error[E0507]: cannot move out of `self.content_type` which is behind a shared reference
  --> src/god/file_layout.rs:46:37
   |
46 |             .join(format!("{:08X}", self.content_type as u32))
   |                                     ^^^^^^^^^^^^^^^^^ move occurs because `self.content_type` has type `con_header::ContentType`, which does not implement the `Copy` trait

For more information about this error, try `rustc --explain E0507`.
agaripian commented 1 year ago

Adding #[derive(Clone, Copy)] to the following line https://github.com/iliazeus/iso2god-rs/blob/master/src/god/con_header.rs#L15 fixed it.

#[derive(Clone, Copy)]
pub enum ContentType {
    GamesOnDemand = 0x7000,
    XboxOriginal = 0x5000,
}
iliazeus commented 1 year ago

I don't quite know why, but I had no such error when writing this code. A new diagnostic, maybe? I am getting it now, after updating my toolchain and doing a clean build. Will update the code to fix this. Thanks for reporting!