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

[wasmparser] 0.218.0 test suite fails with use of undeclared crate or module wat` #1947

Open
Apteryks opened this issue Dec 10, 2024 · 5 comments

Comments

@Apteryks
Copy link

I'm trying to run the test suite, and I'm getting:

   Compiling wasmparser v0.218.0 (/tmp/guix-build-rust-wasmparser-0.218.0.drv-0/wasmparser-0.218.0)
error[E0433]: failed to resolve: use of undeclared crate or module `wat`
    --> src/validator.rs:1515:21
     |
1515 |         let bytes = wat::parse_str(
     |                     ^^^ use of undeclared crate or module `wat`

error[E0433]: failed to resolve: use of undeclared crate or module `wat`
    --> src/validator.rs:1610:21
     |
1610 |         let bytes = wat::parse_str(
     |                     ^^^ use of undeclared crate or module `wat`

error[E0433]: failed to resolve: use of undeclared crate or module `wat`
    --> src/validator.rs:1643:21
     |
1643 |         let bytes = wat::parse_str(
     |                     ^^^ use of undeclared crate or module `wat`

error[E0283]: type annotations needed
  --> src/collections/index_map/tests.rs:45:26
   |
45 |     assert!(map.values().eq([].iter()));
   |                          ^^ cannot infer type of the type parameter `I` declared on the method `eq`
   |
   = note: multiple `impl`s satisfying `i32: PartialEq<_>` found in the following crates: `core`, `serde_json`:
           - impl PartialEq<serde_json::Value> for i32;
           - impl<host> PartialEq for i32
             where the constant `host` has type `bool`;
   = note: required for `&i32` to implement `PartialEq<&_>`
note: required by a bound in `core::iter::Iterator::eq`
  --> /tmp/guix-build-rust-1.77.1.drv-0/rustc-1.77.1-src/library/core/src/iter/traits/iterator.rs:3852:5
help: consider specifying the generic argument
   |
45 |     assert!(map.values().eq::<core::slice::Iter<'_, T>>([].iter()));
   |                            ++++++++++++++++++++++++++++

error[E0283]: type annotations needed
  --> src/collections/index_map/tests.rs:46:30
   |
46 |     assert!(map.values_mut().eq([].iter()));
   |                              ^^ cannot infer type of the type parameter `I` declared on the method `eq`
   |
   = note: multiple `impl`s satisfying `i32: PartialEq<_>` found in the following crates: `core`, `serde_json`:
           - impl PartialEq<serde_json::Value> for i32;
           - impl<host> PartialEq for i32
             where the constant `host` has type `bool`;
   = note: required for `&mut i32` to implement `PartialEq<&_>`
note: required by a bound in `core::iter::Iterator::eq`
  --> /tmp/guix-build-rust-1.77.1.drv-0/rustc-1.77.1-src/library/core/src/iter/traits/iterator.rs:3852:5
help: consider specifying the generic argument
   |
46 |     assert!(map.values_mut().eq::<core::slice::Iter<'_, T>>([].iter()));
   |                                ++++++++++++++++++++++++++++

error[E0283]: type annotations needed
  --> src/collections/index_map/tests.rs:95:26
   |
95 |     assert!(map.values().eq([].iter()));
   |                          ^^ cannot infer type of the type parameter `I` declared on the method `eq`
   |
   = note: multiple `impl`s satisfying `i32: PartialEq<_>` found in the following crates: `core`, `serde_json`:
           - impl PartialEq<serde_json::Value> for i32;
           - impl<host> PartialEq for i32
             where the constant `host` has type `bool`;
   = note: required for `&i32` to implement `PartialEq<&_>`
note: required by a bound in `core::iter::Iterator::eq`
  --> /tmp/guix-build-rust-1.77.1.drv-0/rustc-1.77.1-src/library/core/src/iter/traits/iterator.rs:3852:5
help: consider specifying the generic argument
   |
95 |     assert!(map.values().eq::<core::slice::Iter<'_, T>>([].iter()));
   |                            ++++++++++++++++++++++++++++

error[E0283]: type annotations needed
  --> src/collections/index_map/tests.rs:96:30
   |
96 |     assert!(map.values_mut().eq([].iter()));
   |                              ^^ cannot infer type of the type parameter `I` declared on the method `eq`
   |
   = note: multiple `impl`s satisfying `i32: PartialEq<_>` found in the following crates: `core`, `serde_json`:
           - impl PartialEq<serde_json::Value> for i32;
           - impl<host> PartialEq for i32
             where the constant `host` has type `bool`;
   = note: required for `&mut i32` to implement `PartialEq<&_>`
note: required by a bound in `core::iter::Iterator::eq`
  --> /tmp/guix-build-rust-1.77.1.drv-0/rustc-1.77.1-src/library/core/src/iter/traits/iterator.rs:3852:5
help: consider specifying the generic argument
   |
96 |     assert!(map.values_mut().eq::<core::slice::Iter<'_, T>>([].iter()));
   |                                ++++++++++++++++++++++++++++

Some errors have detailed explanations: E0283, E0433.
For more information about an error, try `rustc --explain E0283`.
error: could not compile `wasmparser` (lib test) due to 7 previous errors
warning: build failed, waiting for other jobs to finish...
error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "cargo" arguments: ("test" "--release") exit-status: 101 term-signal: #f stop-signal: #f> 
phase `check' failed after 9.7 seconds
command "cargo" "test" "--release" failed with status 101
``

As you can see in the Guix output above, the test suite is run using `cargo test --release`.
@alexcrichton
Copy link
Member

Can you provide steps to reproduce this?

Are you perhaps trying to test the crate directly from crates.io? If so that is alas not supported in the Rust ecosystem, so I wouldn't recommend that level of testing.

@Apteryks
Copy link
Author

The failure is reproducible using the GNU Guix cargo-build-system tooling, which exposes just what is needed for the build. Notably, there is no 'wat' crate being made available. This crate appears to come from the top level of the project and not explicitly referenced as a development dependency in the Cargo.toml file of wasmparser, so we were not providing it. Perhaps it should be?

I can't reproduce from a git checkout because then cargo seems to look-up crates in the project top-level and finds a definition for 'wat'.

If you'd like to reproduce using the Guix tooling, I can provide simple instructions to do so.

@Apteryks
Copy link
Author

Apteryks commented Dec 11, 2024

Building from a wasm-tools git checkout, we can see that wat gets picked up/compiled from:

   Compiling wat v1.221.2 (/tmp/wasm-tools/crates/wat)

@Apteryks
Copy link
Author

Apteryks commented Dec 11, 2024

Are you perhaps trying to test the crate directly from crates.io?

Yes!

If so that is alas not supported in the Rust ecosystem, so I wouldn't recommend that level of testing.

The growing Rust package collections in GNU Guix begs to differ :-). Like PyPI, not all source distributions contain the required test data files, but in general they do, or don't need any and the test suite just works.

Building from the git checkout also works, but I've found that because the source lacks share/cargo/registry/*.crate files, this doesn't currently work well with the cargo-build-system in Guix, which relies on these to properly vendor all the transitive crates before a build.

@alexcrichton
Copy link
Member

Ah ok, sorry but this is not a support way of testing these crates right now. If that doesn't integrate with guix I'm sorry about that but for now you'll basically have to not expect this to work.

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