Lstarsky0 requested fitzgen for a review on PR #14151.
Lstarsky0 opened PR #14151 from Lstarsky0:fix/cranelift-module-no-std to bytecodealliance:main:
cargo check -p cranelift-module --no-default-featuresfails on main with 11 errors, and--no-default-features --features corefails with 6. Both have been broken since #5173 (2022-11-03).What is broken
cranelift/module/src/lib.rsis#![no_std]and aliasesallocasstdwhen thestdfeature is off:#[cfg(not(feature = "std"))] extern crate alloc as std;
module.rsthen uses three paths that only exist in realstd:
site path ModuleError::Allocationpayloadstd::io::Errorthe Errorimpl and itssource()std::error::Errortwo Fromimplsstd::convert::From
--features coredoes not help — it only pulls inhashbrown, so the same three paths still fail. Bare--no-default-featuresfails on those plushashbrownitself, which the manifest only supplies throughcore.Why it went unnoticed
cranelift-moduleappears in no file under.github/, so no job builds it in any non-default configuration.The one configuration that forwards to it cannot catch it either.
cranelift'scorefeature listscranelift-module?/core, but the umbrella declarescranelift-module = { workspace = true, optional = true }without
default-features = false, and the workspace entry does not set it either, socranelift-module/stdis on whenever the dep is.cargo tree -e features -p cranelift --no-default-features --features core,moduleshowscoreandstdboth active.cranelift-codegenis declared withdefault-features = falseat the workspace level;cranelift-frontendandcranelift-moduleare not.I have left that alone — whether
cranelift'scoreshould actually mean core is a separate call, and it would need this fix first anyway.The change
Allocationis gated onstd. The payload is astd::io::Errorand the only producer iscranelift-jit(compiled_blob.rs), which needsstdregardless.core::error::Errorinstead ofstd::error::Error— stable since 1.81, MSRV here is 1.95. PlainFrominstead ofstd::convert::From.hashbrownbecomes non-optional, matchingcranelift-frontend, which has the identical#[cfg(not(feature = "std"))] use hashbrown::...and a non-optionalhashbrown. Thehashbrownfeature is dropped fromcoreas a result.That last one removes the
cranelift-module/hashbrownfeature. Nothing in the workspace names it; the umbrella only forwards?/stdand?/core.Testing
Three checks added to the
micro_checksmatrix. On unpatched main they fail:
check main with this PR -p cranelift-module --no-default-features11 errors ok -p cranelift-module --no-default-features --features core6 errors ok -p cranelift-module --no-default-features --features core,enable-serde6 errors ok Also run locally, all clean:
-p cranelift-module --all-features,cargo test -p cranelift-module,cargo clippy -p cranelift-module --all-targetsand the same with--no-default-features,cargo fmt --all -- --check, andcargo checkforcranelift-jit,cranelift-object,cranelift,cranelift-filetestsandcranelift-tools.Cargo.lockis unchanged.This does not make the crate buildable for a bare-metal target on its own —
anyhowis a hard dependency carryingfeatures = ['std']. It makes the configurations the crate already advertises compile again.
Lstarsky0 requested wasmtime-compiler-reviewers for a review on PR #14151.
Lstarsky0 requested wasmtime-default-reviewers for a review on PR #14151.
bjorn3 commented on PR #14151:
std::error::Erroris just a re-export ofcore::error::Error.
bjorn3 deleted a comment on PR #14151:
std::error::Erroris just a re-export ofcore::error::Error.
github-actions[bot] added the label cranelift on PR #14151.
github-actions[bot] added the label cranelift:module on PR #14151.
:repeat: pchickey submitted PR review:
First, please review the AI tool policy https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.md
Second, cranelift-codegen's Cargo.toml describes that the
corefeature is no longer used, remaining in name only for compatibility purposes. So, cranelift-module's use of that feature also no longer needs to exist, and does not need to consume CI resources with test coverage.
Lstarsky0 updated PR #14151.
Lstarsky0 commented on PR #14151:
Read the policy. you are right about core, codegen has it as core = [], name only now. Dropped the forward and the two --features core CI lines with it. I left it as core = [] rather than deleting outright, since umbrella forwards cranelift-module?/core and the crate is published. Happy to delete both if you'd rather. frontend and native carry the same dead forward; left those alone.
The build fix underneath is a separate thing from core though. cargo check -p cranelift-module --no-default-features is 8 errors on main right now — hashbrown is imported unconditionally but was only pulled in by core, and a few impls reach for std::. That's what the one remaining CI line covers.
:thumbs_up: pchickey submitted PR review.
pchickey added PR #14151 cranelift-module: fix the no_std build and cover it in CI to the merge queue.
pchickey commented on PR #14151:
Thank you
:check: pchickey merged PR #14151.
pchickey removed PR #14151 cranelift-module: fix the no_std build and cover it in CI from the merge queue.
Last updated: Aug 30 2026 at 09:07 UTC