Skip to content

Instantly share code, notes, and snippets.

@rektide
Last active September 9, 2018 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rektide/f448b6e1a69b29c4fbdfbd4f420ff6ab to your computer and use it in GitHub Desktop.
Save rektide/f448b6e1a69b29c4fbdfbd4f420ff6ab to your computer and use it in GitHub Desktop.
issues compiling input.rs
Downloading libc v0.2.43
Downloading bitflags v1.0.4
Downloading udev v0.2.0
Downloading libudev-sys v0.1.4
Downloading pkg-config v0.3.14
Compiling pkg-config v0.3.14
Compiling input-sys v1.9.0 (file:///home/rektide/src/archive/input.rs/input-sys)
Compiling libc v0.2.43
Compiling bitflags v1.0.4
Compiling libudev-sys v0.1.4
Compiling udev v0.2.0
Compiling input v0.4.0 (file:///home/rektide/src/archive/input.rs)
warning: type annotations needed
--> src/device.rs:328:16
|
328 | if ptr.is_null() {
| ^^^^^^^
|
= note: #[warn(tyvar_behind_raw_pointer)] on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
= note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>

device.rs exceprt, https://github.com/Smithay/input.rs/blob/master/src/device.rs#L328 :

    pub unsafe fn udev_device(&self, context: &UdevContext) -> Option<UdevDevice> {
        let ptr = ffi::libinput_device_get_udev_device(self.ffi) as *mut _;
        if ptr.is_null() {
            None
        } else {
            Some(UdevDevice::from_raw(&context, ptr))
        }
    }

extern for libinput_device_get_udev_device, https://github.com/Smithay/input.rs/blob/master/input-sys/src/gen.rs#L2719 :

 pub fn libinput_device_get_udev_device ( device : * mut libinput_device , ) -> * mut udev_device ;
} extern "C" {

I tried: input_sys::udev_device:

error[E0658]: access to extern crates through prelude is experimental (see issue #44660)
   --> src/device.rs:327:74
    |
327 |         let ptr = ffi::libinput_device_get_udev_device(self.ffi) as *mut input_sys::udev_device;
    |                                                                          ^^^^^^^^^

error[E0308]: mismatched types
   --> src/device.rs:331:49
    |
331 |             Some(UdevDevice::from_raw(&context, ptr))
    |                                                 ^^^ expected struct `libudev_sys::udev_device`, found struct `input_sys::udev_device`
    |
    = note: expected type `*mut libudev_sys::udev_device`
               found type `*mut input_sys::udev_device`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment