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

minimal-web example fails to build #406

Closed
tommythorn opened this issue Nov 12, 2024 · 1 comment · Fixed by #407
Closed

minimal-web example fails to build #406

tommythorn opened this issue Nov 12, 2024 · 1 comment · Fixed by #407
Labels
bug Something isn't working examples A bug or improvement for an example

Comments

@tommythorn
Copy link

tommythorn commented Nov 12, 2024

Env: iMac 5K (x86), macOS 15.1, Rust 1.82

Repro:
$ git clone https://github.com/parasyte/pixels.git
$ cd pixels/examples/minimal-web
$ rustup target add wasm32-unknown-unknown
$ cargo run-wasm --release --package minimal-web

...
   Compiling minimal-web v0.1.0 (/Users/tommy/projects/Rust/pixels/examples/minimal-web)
error[E0599]: no method named `set_inner_size` found for struct `Rc<winit::window::Window>` in the current scope
   --> examples/minimal-web/src/main.rs:75:16
    |
75  |         window.set_inner_size(get_window_size());
    |                ^^^^^^^^^^^^^^
    |
help: there is a method `inner_size` with a similar name, but with different arguments
   --> /Users/tommy/.cargo.x86_64-darwin/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/window.rs:746:5
    |
746 |     pub fn inner_size(&self) -> PhysicalSize<u32> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0277]: the trait bound `Element: From<Option<HtmlCanvasElement>>` is not satisfied
  --> examples/minimal-web/src/main.rs:84:36
   |
84 |                 body.append_child(&web_sys::Element::from(window.canvas()))
   |                                    ^^^^^^^^^^^^^^^^ the trait `From<Option<HtmlCanvasElement>>` is not implemented for `Element`
   |
   = help: the following other types implement trait `From<T>`:
             `Element` implements `From<HtmlCanvasElement>`
             `Element` implements `From<HtmlElement>`
             `Element` implements `From<HtmlImageElement>`
             `Element` implements `From<HtmlMediaElement>`
             `Element` implements `From<HtmlVideoElement>`
             `Element` implements `From<JsValue>`

error[E0599]: no method named `set_inner_size` found for struct `Rc<winit::window::Window>` in the current scope
   --> examples/minimal-web/src/main.rs:93:20

    |
93  |             window.set_inner_size(size)
    |                    ^^^^^^^^^^^^^^
    |
help: there is a method `inner_size` with a similar name, but with different arguments
   --> /Users/tommy/.cargo.x86_64-darwin/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/window.rs:746:5
    |
746 |     pub fn inner_size(&self) -> PhysicalSize<u32> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `minimal-web` (bin "minimal-web") due to 3 previous errors
@parasyte
Copy link
Owner

This is terrible! The CI test that was supposed to ensure this example builds correctly has an uncaught error: https://github.com/parasyte/pixels/actions/runs/11760417671/job/32760982455

The run-wasm command does not return an error code when the command fails, and CI passes the wrong arguments. The run-wasm issue is an upstream bug. The CI issue and the build failure is on me. I can fix those, at least.

parasyte added a commit that referenced this issue Nov 12, 2024
This should cause the CI job to fail as shown in #406
@parasyte parasyte added bug Something isn't working examples A bug or improvement for an example labels Nov 13, 2024
parasyte added a commit that referenced this issue Nov 13, 2024
parasyte added a commit that referenced this issue Nov 13, 2024
Adds CI steps to check and lint the example. And fixes build failures introduced by updating `winit` and `wgpu` in #391.

`run-wasm` still won't fail out the WASM CI job when there are build errors. That is tracked upstream in rukai/cargo-run-wasm#49

Closes #406
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working examples A bug or improvement for an example
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants