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

Invalid raw-window-handle calls #571

Open
HoloTheDrunk opened this issue Jun 3, 2024 · 1 comment
Open

Invalid raw-window-handle calls #571

HoloTheDrunk opened this issue Jun 3, 2024 · 1 comment

Comments

@HoloTheDrunk
Copy link

Trying to build with features glfw-sys, raw-window-handle-v0-6 and wayland and getting the following error:

Screenshot with highlighting

screenshot

Error

error[E0061]: this function takes 1 argument but 2 arguments were supplied
    --> /home/RDuhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glfw-0.56.0/src/lib.rs:3689:22
     |
3689 |         let handle = WaylandDisplayHandle::new(display, 0);
     |                      ^^^^^^^^^^^^^^^^^^^^^^^^^          - unexpected argument of type `{integer}`
     |
note: expected `NonNull<c_void>`, found `Option<NonNull<c_void>>`
    --> /home/RDuhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glfw-0.56.0/src/lib.rs:3689:48
     |
3689 |         let handle = WaylandDisplayHandle::new(display, 0);
     |                                                ^^^^^^^
     = note: expected struct `NonNull<_>`
                  found enum `Option<NonNull<_>>`
note: associated function defined here
    --> /home/RDuhen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/raw-window-handle-0.6.2/src/unix.rs:176:12
     |
176  |     pub fn new(display: NonNull<c_void>) -> Self {
     |            ^^^
help: consider using `Option::expect` to unwrap the `Option<NonNull<c_void>>` value, panicking if the value is an `Option::None`
     |
3689 |         let handle = WaylandDisplayHandle::new(display.expect("REASON"), 0);
     |                                                       +++++++++++++++++
help: remove the extra argument
     |
3689 -         let handle = WaylandDisplayHandle::new(display, 0);
3689 +         let handle = WaylandDisplayHandle::new(/* NonNull<c_void> */);
     |

The fix is simple but after looking at the documentation for raw-window-handle I couldn't find a single version where the WaylandDisplayHandle::new function took 2 arguments, is there a special reason why it does here?

@HoloTheDrunk
Copy link
Author

Oops, looks like this is handled by #570

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

1 participant