Skip to content

Conversation

@j-vanderstoep
Copy link

I see the following error when attempting to build zlib-rs tests in the Android project, although not when building with Cargo (not sure why):

error: cannot determine resolution for the import
--> external/rust/android-crates-io/crates/zlib-rs/src/crc32.rs:93:9
|
93 | use test::braid::crc32_braid;
| ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0659]: test is ambiguous
--> external/rust/android-crates-io/crates/zlib-rs/src/crc32.rs:93:9
|
93 | use test::braid::crc32_braid;
| ^^^^ ambiguous name
|
= note: ambiguous because of a conflict between a name from a glob import and
an outer scope during import or macro resolution
= note: test could refer to a crate passed with --extern
= help: use ::test to refer to this crate unambiguously
note: test could also refer to the module imported here
--> external/rust/android-crates-io/crates/zlib-rs/src/crc32.rs:95:9
|
95 | use super::*;
| ^^^^^^^^
= help: consider adding an explicit import of test to disambiguate
= help: or use self::test to refer to this module unambiguously

Removing "test::" fixes it. Tests continue to pass both using cargo and the Android build system.

I see the following error when attempting to build zlib-rs tests in
the Android project, although not when building with Cargo (not sure
why):

error: cannot determine resolution for the import
  --> external/rust/android-crates-io/crates/zlib-rs/src/crc32.rs:93:9
   |
93 |     use test::braid::crc32_braid;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0659]: `test` is ambiguous
  --> external/rust/android-crates-io/crates/zlib-rs/src/crc32.rs:93:9
   |
93 |     use test::braid::crc32_braid;
   |         ^^^^ ambiguous name
   |
   = note: ambiguous because of a conflict between a name from a glob import and
 an outer scope during import or macro resolution
   = note: `test` could refer to a crate passed with `--extern`
   = help: use `::test` to refer to this crate unambiguously
note: `test` could also refer to the module imported here
  --> external/rust/android-crates-io/crates/zlib-rs/src/crc32.rs:95:9
   |
95 |     use super::*;
   |         ^^^^^^^^
   = help: consider adding an explicit import of `test` to disambiguate
   = help: or use `self::test` to refer to this module unambiguously

Removing "test::" fixes it. Tests continue to pass both using cargo
and the Android build system.
@bjorn3
Copy link
Collaborator

bjorn3 commented Jun 2, 2025

How exactly are you building zlib-rs? Are you passing --extern test=/path/to/libtest.rlib? If so try passing --extern noprelude:test=/path/to/libtest.rlib instead to ensure you need an explicit extern crate test; just like for regular compilation. cargo build -Zbuild-std also uses the noprelude flag for all standard library dependencies.

@codecov
Copy link

codecov bot commented Jun 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Flag Coverage Δ
fuzz-compress ?
fuzz-decompress ?
test-aarch64-apple-darwin 93.39% <ø> (ø)
test-x86_64-apple-darwin 91.70% <ø> (ø)
test-x86_64-unknown-linux-gnu 90.45% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
zlib-rs/src/crc32.rs 94.84% <ø> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@folkertdev folkertdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a confusing import in any case (going via the user super::*), so let's remove that. Thanks!

@folkertdev folkertdev merged commit 2b1270c into trifectatechfoundation:main Jun 2, 2025
24 checks passed
@j-vanderstoep
Copy link
Author

Thank you!

How exactly are you building zlib-rs? Are you passing --extern test=/path/to/libtest.rlib? If so try passing --extern noprelude:test=/path/to/libtest.rlib instead to ensure you need an explicit extern crate test; just like for regular compilation. cargo build -Zbuild-std also uses the noprelude flag for all standard library dependencies.

@bjorn3 we'll look into this. Seems like a good opportunity to make our build a bit more robust. Thanks for the suggestion!

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

Successfully merging this pull request may close these issues.

4 participants