Skip to content

Structured resolver errors#2482

Merged
alexcrichton merged 29 commits intobytecodealliance:mainfrom
PhoebeSzmucer:structured-resolver-errors
May 5, 2026
Merged

Structured resolver errors#2482
alexcrichton merged 29 commits intobytecodealliance:mainfrom
PhoebeSzmucer:structured-resolver-errors

Conversation

@PhoebeSzmucer
Copy link
Copy Markdown
Contributor

Part of #2460 (part 1 was here).

This PR replaces most of anyhow usages in the resolver with structured ParserError type, which carries structured error information (with spans).

@alexcrichton
Copy link
Copy Markdown
Member

Happy to take a look when you feel this is ready, but I'm interpreting the draft state as "come back later" for now -- just wanted to note this

@PhoebeSzmucer
Copy link
Copy Markdown
Contributor Author

Thanks @alexcrichton. No review needed just yet - I'm still cleaning up some final things and do one more self review, and I'll mark it as ready soon.

Comment thread crates/wit-parser/src/ast/error.rs
Comment thread crates/wit-parser/src/resolve/mod.rs
Comment thread crates/wit-smith/src/lib.rs Outdated
Comment thread crates/wit-parser/src/resolve/mod.rs
Comment thread crates/wit-parser/src/resolve/mod.rs
Comment thread crates/wit-parser/src/resolve/mod.rs
@PhoebeSzmucer PhoebeSzmucer marked this pull request as ready for review April 10, 2026 10:04
@PhoebeSzmucer PhoebeSzmucer requested a review from a team as a code owner April 10, 2026 10:04
@PhoebeSzmucer PhoebeSzmucer requested review from fitzgen and removed request for a team April 10, 2026 10:04
@PhoebeSzmucer
Copy link
Copy Markdown
Contributor Author

@alexcrichton this is ready for a review now. I left some inline comments on the PR

@alexcrichton alexcrichton requested review from alexcrichton and removed request for fitzgen April 10, 2026 20:36
Comment thread crates/wit-parser/src/resolve/fs.rs Outdated
Comment thread crates/wit-smith/src/lib.rs Outdated
Comment thread crates/wit-parser/src/resolve/mod.rs
Comment thread crates/wit-parser/src/resolve/mod.rs
@@ -1,4 +1,4 @@
failed to process feature gate for included world [a] in package [test:invalid@0.1.0]: feature gate cannot reference unreleased version 0.2.0 of package [test:invalid@0.1.0] (current version 0.1.0)
feature gate cannot reference unreleased version 0.2.0 of package [test:invalid@0.1.0] (current version 0.1.0)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As a follow up I think we should change the snippet to point to the bad version.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And this error could become much nicer potentially - I find the current phrasing a bit vague.

Copy link
Copy Markdown
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.

Everything here looks great to me, thanks again @PhoebeSzmucer! I think it's fine for anything further to be in follow-ups, so let's go ahead and land this.

@alexcrichton alexcrichton added this pull request to the merge queue May 5, 2026
Merged via the queue into bytecodealliance:main with commit d19bbee May 5, 2026
37 checks passed
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