Skip to content

fix(rust): Restrict equal types to the current world#1549

Merged
alexcrichton merged 9 commits intobytecodealliance:mainfrom
chenyan2002:fix-eq-types
Feb 27, 2026
Merged

fix(rust): Restrict equal types to the current world#1549
alexcrichton merged 9 commits intobytecodealliance:mainfrom
chenyan2002:fix-eq-types

Conversation

@chenyan2002
Copy link
Contributor

@chenyan2002 chenyan2002 commented Feb 19, 2026

Fix #1543

  • Move name_interface to preprocess phase to avoid crashing when referring to not-yet-generated types from bindgen
  • Restrict equal types to the current world, so that bindgen doesn't refer to types not reachable from the current world
  • Reenable test wasi-filesystem-merge-equal, which is fixed by this PR.

@alexcrichton
Copy link
Member

Oh sorry I didn't realize this was ready for some review. I figured draft + failing tests meant there was still some work to do locally.

These changes in general look good to me, I'm not entirely sure what would cause the test failures though. To me though it seems like it's in the right direction at least for resolving #1543 (I'd also request to be sure to include tests as well here though)

@chenyan2002 chenyan2002 marked this pull request as ready for review February 27, 2026 17:28
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

Thanks!

let types: Vec<_> = resolve
.types
.iter()
.filter(|(t, _)| live_types.contains(*t))
Copy link
Member

Choose a reason for hiding this comment

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

Oh for this it should be sufficient to switch the iterator below to iterating over the live_types set, no need to iterate over the resolve's types, filter to what live_types has, and then iterate over that set

@chenyan2002
Copy link
Contributor Author

Thanks! This is indeed much better!

@alexcrichton alexcrichton added this pull request to the merge queue Feb 27, 2026
Merged via the queue into bytecodealliance:main with commit 4a48c99 Feb 27, 2026
27 checks passed
@chenyan2002 chenyan2002 deleted the fix-eq-types branch February 27, 2026 19:42
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.

rust: bug with merge structurally equal types

2 participants