Skip to content

kiln-component does not compile in isolation: cargo check -p kiln-component fails on clean main (default = ["kiln-runtime/std"] never enables its OWN std feature) #446

Description

@avrabe

Summary

kiln-component fails to compile standalone on clean main — with default features and with --features std. The workspace build is green only because feature unification from sibling crates papers over it. Found while adding a regression test for #427: cargo test -p kiln-component cannot build, so the crate's tests are unrunnable in isolation.

Verified on main (8b9fa4b7) with a clean tree (no local changes).

Reproduction

$ cargo check -p kiln-component
error[E0433]: cannot find module or crate `std` in this scope     (x3)
error[E0599]: no method named `link_imports_lenient` found for struct `ComponentLinker`
error[E0599]: no method named `link_imports` found for struct `ComponentLinker`
error: could not compile `kiln-component` (lib) due to 5 previous errors

$ cargo check -p kiln-component --features std
error: could not compile `kiln-component` (lib) due to 4 previous errors

$ cargo check --workspace     # green — feature unification hides it

Root cause

kiln-component/Cargo.toml:

[features]
# By default, enable std to match kiln-runtime's default behavior
default = ["kiln-runtime/std"]

default enables the dependency's std, but never kiln-component's own std feature. So the crate compiles without feature = "std" set on itself, and everything behind #[cfg(feature = "std")] — including ComponentLinker::link_imports / link_imports_lenient and the std imports — disappears, while the call sites (e.g. component_instantiation.rs:946) remain unconditional. Hence E0433/E0599.

The comment says the intent was "consistent feature resolution across workspace and isolated builds" — it achieves the opposite: the isolated build is the one that breaks.

Impact

Suggested fix

default = ["std"] (and have kiln-component's own std feature enable kiln-runtime/std, which the std = [...] list already appears structured to do). Then add a per-crate isolated-build check (cargo check -p kiln-component --no-default-features / default / --features std) so unification can't hide it again. The remaining 4 errors under --features std need triage — the cfg'd methods may have drifted from their call sites independently.

Found while working #427 / SR-52 (PR #445).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions