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

Broken crate using rust 1.6 #55

Closed
MagaTailor opened this issue Dec 12, 2015 · 2 comments
Closed

Broken crate using rust 1.6 #55

MagaTailor opened this issue Dec 12, 2015 · 2 comments

Comments

@MagaTailor
Copy link

Due to this issue the crate no longer compiles:

Compiling sdl2_image v0.6.0
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/sdl2_image-0.6.0/src/sdl2_image/lib.rs:73:37: 73:95 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/sdl2_image-0.6.0/src/sdl2_image/lib.rs:73             let raw = ffi::IMG_Load(CString::new(filename.to_str().unwrap()).unwrap().as_ptr());
                                                                                                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/sdl2_image-0.6.0/src/sdl2_image/lib.rs:73:37: 73:95 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/sdl2_image-0.6.0/src/sdl2_image/lib.rs:99:55: 99:113 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/sdl2_image-0.6.0/src/sdl2_image/lib.rs:99             let status = ffi::IMG_SavePNG(self.raw(), CString::new(filename.to_str().unwrap()).unwrap().as_ptr());
                                                                                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/sdl2_image-0.6.0/src/sdl2_image/lib.rs:99:55: 99:113 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/sdl2_image-0.6.0/src/sdl2_image/lib.rs:131:56: 131:114 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/sdl2_image-0.6.0/src/sdl2_image/lib.rs:131             let raw = ffi::IMG_LoadTexture(self.raw(), CString::new(filename.to_str().unwrap()).unwrap().as_ptr());
                                                                                                                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/sdl2_image-0.6.0/src/sdl2_image/lib.rs:131:56: 131:114 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/sdl2_image-0.6.0/src/sdl2_image/lib.rs:218:50: 218:98 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/sdl2_image-0.6.0/src/sdl2_image/lib.rs:218             ffi::IMG_LoadTyped_RW(self.raw(), 0, CString::new(_type.as_bytes()).unwrap().as_ptr())
                                                                                                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/sdl2_image-0.6.0/src/sdl2_image/lib.rs:218:50: 218:98 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 4 previous errors

A mechanical cast as *const _ seems to be enough of a fix in most cases.
Rust 1.5 is still fine.

@babariviere
Copy link
Contributor

Does it work for rust 1.6 now?

@MagaTailor
Copy link
Author

Fixed in fe4ce58

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