Skip to content

Make sha2 an optional dependency of wasmtime-environ - #14305

Merged
pchickey merged 1 commit into
bytecodealliance:mainfrom
CfirTsabari:fix-sha2-optional
Sep 9, 2026
Merged

Make sha2 an optional dependency of wasmtime-environ#14305
pchickey merged 1 commit into
bytecodealliance:mainfrom
CfirTsabari:fix-sha2-optional

Conversation

@CfirTsabari

Copy link
Copy Markdown
Contributor

The only code referencing sha2 is the use sha2::{Digest, Sha256}
import and the WasmChecksum::from_binary call site in
module_artifacts.rs, both of which are already behind
#[cfg(feature = "rr")]. Despite that, sha2 was declared as a plain
dependency, so every consumer of wasmtime-environ compiled and linked
it even when rr was disabled and the code was dead.

Mark the dependency optional = true and add dep:sha2 to the rr
feature so it is only pulled in when it is actually used. No code
changes were needed; the existing cfg gates already cover every
reference.

The only code referencing `sha2` is the `use sha2::{Digest, Sha256}`
import and the `WasmChecksum::from_binary` call site in
`module_artifacts.rs`, both of which are already behind
`#[cfg(feature = "rr")]`. Despite that, `sha2` was declared as a plain
dependency, so every consumer of `wasmtime-environ` compiled and linked
it even when `rr` was disabled and the code was dead.

Mark the dependency `optional = true` and add `dep:sha2` to the `rr`
feature so it is only pulled in when it is actually used. No code
changes were needed; the existing `cfg` gates already cover every
reference.
@CfirTsabari
CfirTsabari requested a review from a team as a code owner September 9, 2026 13:19
@CfirTsabari
CfirTsabari requested review from pchickey and removed request for a team September 9, 2026 13:19
@pchickey
pchickey added this pull request to the merge queue Sep 9, 2026
Merged via the queue into bytecodealliance:main with commit e8890cc Sep 9, 2026
54 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