Allow unreachable_code in wasm error helper#1687
Merged
leighmcculloch merged 2 commits intomainfrom Jan 22, 2026
Merged
Conversation
leighmcculloch
commented
Jan 20, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a #[allow(unreachable_code)] attribute to suppress a new compiler warning introduced in Rust 1.92.0 for the error_from_error_val function when targeting wasm.
Changes:
- Adds
#[allow(unreachable_code)]attribute to the wasm-targetederror_from_error_valfunction to suppress a warning about unreachable closing brace
Member
Author
|
The docs ci failure is unrelated to this change and a compiler bug: |
graydon
approved these changes
Jan 21, 2026
Contributor
graydon
left a comment
There was a problem hiding this comment.
I concur with your assessment (though I also concur with "this is a little murky and I could be wrong")
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.
What
Add
#[allow(unreachable_code)]attribute to theerror_from_error_valfunction for wasm targets to suppress a compiler warning introduced in Rust 1.92.0.Why
I started seeing the following errors when building contracts using the soroban-sdk:
It appears Rust 1.92.0 changed how
unreachable_codewarnings are detected.The
error_from_error_valfunction returnsInfallible, an uninhabited type. This is intentional behaviour. The function is designed to never return so the warning is suppressed.I think this is probably the result of rust-lang/rust#142390 which landed in 1.92.0, but that change is quite deep and so I'm not certain of that.
In any case, I don't think what the code is doing here is incorrect, just a new warning is highlighting that there's an unreachable condition here, which is expected, so we should allow the condition.