glfw-rs
glfw-rs copied to clipboard
Invalid raw-window-handle calls
Trying to build with features glfw-sys
, raw-window-handle-v0-6
and wayland
and getting the following error:
Screenshot with highlighting
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?