Skip to content

perry-stdlib fails to build with --no-default-features (breaks auto-optimize relink) #7764

Description

@proggeramlug

Summary

perry-stdlib does not compile with --no-default-features, which is the configuration the auto-optimize relink uses. Every perry compile that triggers auto-optimize falls back to prebuilt archives with a warning, and any ad-hoc build needs PERRY_NO_AUTO_OPTIMIZE=1 as a workaround.

Reproduction

cargo build -p perry-stdlib --no-default-features
error[E0433]: cannot find `events` in `crate`
   --> crates/perry-stdlib/src/common/dispatch/init.rs:668:57
    |
668 |     perry_runtime::js_set_native_events_dispatch(crate::events::js_events_native_dispatch);
    |                                                         ^^^^^^ could not find `events` in the crate root
    |
note: found an item that was configured out
   --> crates/perry-stdlib/src/lib.rs:57:9
    |
 56 | #[cfg(feature = "bundled-events")]
    |       -------------------------- the item is gated behind the `bundled-events` feature
 57 | pub mod events;

Two further instances of the same shape:

error[E0433]: cannot find `async_bridge` in `common`
  --> crates/perry-stdlib/src/worker_threads/broadcast_channel.rs:67:20
  --> crates/perry-stdlib/src/worker_threads/broadcast_channel.rs:102:20

gated behind async-runtime.

Cause

The call site added in #7745 (route the module-level events.* helpers through the dynamic dispatch) is not behind the #[cfg(feature = "bundled-events")] that gates the module it references. The neighbouring dispatch registrations in the same function are cfg-gated — e.g. the database-sqlite line immediately below it — so this looks like an omission rather than a design choice.

Impact

Auto-optimize prints:

auto-optimize: cargo build failed, using prebuilt libraries. The prebuilt archives may lack the feature-gated js_* entrypoints this compile routed to ext crates; if the link fails with undefined symbols, fix the cargo error above

so the failure is soft — but it silently gives up the feature-stripped rebuild, which is the whole point of the pass.

Fix

Gate the three call sites to match the modules they reference (bundled-events, async-runtime). Worth adding a CI arm that builds perry-stdlib --no-default-features, since nothing currently covers the configuration auto-optimize actually uses.

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