Make sha2 an optional dependency of wasmtime-environ - #14305
Merged
Conversation
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.
pchickey
approved these changes
Sep 9, 2026
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.
The only code referencing
sha2is theuse sha2::{Digest, Sha256}import and the
WasmChecksum::from_binarycall site inmodule_artifacts.rs, both of which are already behind#[cfg(feature = "rr")]. Despite that,sha2was declared as a plaindependency, so every consumer of
wasmtime-environcompiled and linkedit even when
rrwas disabled and the code was dead.Mark the dependency
optional = trueand adddep:sha2to therrfeature so it is only pulled in when it is actually used. No code
changes were needed; the existing
cfggates already cover everyreference.