Repository navigation
Fix mojo package build under Mojo 1.0.0 - #184
Merged
Merged
Conversation
The library compiled and tested fine, but 'mojo package src/regex' failed with 33 errors, so the conda recipe in modular-community could not build the .mojopkg. The test suite never caught this because building a test binary does not type-check every path that packaging does. Two problems: - 31 uses of len() on a String or StringSlice. Mojo 1.0.0 rejects these because a single length is ambiguous for UTF-8 text. All of them meant the byte count, so they become byte_length(). len() on List is untouched. - match_chunk() is a parametric trait method whose size parameter could not be inferred at two call sites in simd_ops. Pass it explicitly as match_chunk[16](chunk), matching the 16-byte chunk being loaded. 'mojo package src/regex' now succeeds and the full suite still passes (399 tests, 0 failures).
CI ran only the test suite, which does not type-check every path that 'mojo package' does. That let the package build break while tests stayed green, and the failure only surfaced in the modular-community conda recipe build.
msaelices
added a commit
to msaelices/modular-community
that referenced
this pull request
Sep 1, 2026
The previous build failed because 'mojo package src/regex' did not compile under Mojo 1.0.0: len() on String/StringSlice is rejected there, and two match_chunk() call sites could not infer their size parameter. msaelices/mojo-regex#184 fixes both and adds a CI step that builds the package, so this cannot regress unnoticed again.
This was referenced Sep 1, 2026
alisterburt
pushed a commit
to modular/modular-community
that referenced
this pull request
Sep 1, 2026
* Bump mojo-regex from 0.10.0 to 0.21.0 * Pin mojo-regex 0.21.0 to a63fd53 (includes final consolidated changelog) * Use the full 40-char commit SHA in the mojo-regex source rev rattler-build fetches the rev as a git ref and GitHub only serves full SHAs, so the short form fails with 'couldn't find remote ref'. * Pin mojo-regex 0.21.0 to stable Mojo 1.0.0 Mojo 1.0.0 is now released on the stable max channel, so the recipe can pin mojo_version =1.0.0 (previously a dev nightly that never existed in the stable channel, which blocked the build). Bumps source rev to the current mojo-regex main (on stable 1.0.0). * Point mojo-regex 0.21.0 at the packaging fix for Mojo 1.0.0 The previous build failed because 'mojo package src/regex' did not compile under Mojo 1.0.0: len() on String/StringSlice is rejected there, and two match_chunk() call sites could not infer their size parameter. msaelices/mojo-regex#184 fixes both and adds a CI step that builds the package, so this cannot regress unnoticed again. --------- Co-authored-by: Caroline Frasca <42614552+carolinefrasca@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
mojo package src/regexfails under Mojo 1.0.0 with 33 errors, so theconda recipe in
modular-communitycannot build the.mojopkg. This iswhat failed the build on
modular-community#293,
which was closed as a result.
The test suite never caught it: building a test binary does not type-check
every path that packaging does, so
pixi run teststayed green the wholetime.
Fixes
len()on aString/StringSlice. Mojo 1.0.0 rejectsthese because a single length is ambiguous for UTF-8 text (bytes vs
codepoints vs graphemes). Every one of them meant the byte count, so they
become
byte_length().len()onListis deliberately untouched.match_chunk()size parameter could not be inferred at two callsites in
simd_ops, since it is a parametric trait method. Passedexplicitly as
match_chunk[16](chunk), matching the 16-byte chunk beingloaded right above.
Prevention
CI ran only
pixi run test. Added a step that builds the package, so thisclass of breakage fails here instead of in the conda recipe.
Verification
mojo package src/regexnow succeeds (696 KB.mojopkg)