Skip to content

fix(rust): fully qualify Option and Result types - #1676

Merged
pchickey merged 1 commit into
bytecodealliance:mainfrom
scothis:result-declobber
Aug 5, 2026
Merged

fix(rust): fully qualify Option and Result types#1676
pchickey merged 1 commit into
bytecodealliance:mainfrom
scothis:result-declobber

Conversation

@scothis

@scothis scothis commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

When expanding the wit option and result types to rust, they were printed as Option and Result respectively. This can cause collisions with locally defined types that happen to share the same name.

For example:

type %result = bool;

// should return a result, but is generated returning the local alias
no-clobber: func() -> result<_, _>;

The generated types for option and result now expand to ::core::option::Option and ::core::result::Result.

When expanding the wit `option` and `result` types to rust, they were
printed as `Option` and `Result` respectively. This can cause collisions
with locally defined types that happen to share the same name.

For example:

```
type %result = bool;

// should return a result, but is generated returning the local alias
no-clobber: func() -> result<_, _>;
```

The generated types for `option` and `result` now expand to
`::core::option::Option` and `::core::result::Result`.

Signed-off-by: Scott Andrews <scott@andrews.me>
@pchickey
pchickey added this pull request to the merge queue Aug 5, 2026
Merged via the queue into bytecodealliance:main with commit 0781ccd Aug 5, 2026
29 checks passed
@scothis
scothis deleted the result-declobber branch August 5, 2026 20:12
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.

2 participants