Skip to content

feat(anyspawn): Make Spawner usable without features#343

Merged
AdomasBekeras merged 13 commits intomainfrom
u/abekeras/make_spawner_usable_with_no_features
Mar 27, 2026
Merged

feat(anyspawn): Make Spawner usable without features#343
AdomasBekeras merged 13 commits intomainfrom
u/abekeras/make_spawner_usable_with_no_features

Conversation

@AdomasBekeras
Copy link
Copy Markdown
Contributor

@AdomasBekeras AdomasBekeras commented Mar 26, 2026

To use Spawner in a library, the library should not need to enable any features, it can just take a Spawner. This PR removes the feature gates from the Spaner and JoinHandle types

@AdomasBekeras AdomasBekeras changed the title Make Spawner usable without features feat(anyspawn): Make Spawner usable without features Mar 26, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (85ef2c7) to head (b7f0df2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #343   +/-   ##
=======================================
  Coverage   100.0%   100.0%           
=======================================
  Files         210      210           
  Lines       15553    15553           
=======================================
  Hits        15553    15553           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ADOMAS BEKERAS (from Dev Box) added 2 commits March 26, 2026 15:10
@martintmk
Copy link
Copy Markdown
Member

I suggest to also have empty default features.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 26, 2026

⚠️ Breaking Changes Detected


--- failure feature_missing: package feature removed or renamed ---

Description:
A feature has been removed from this package's Cargo.toml. This will break downstream crates which enable that feature.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#cargo-feature-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/feature_missing.ron

Failed in:
  feature custom in the package's Cargo.toml

--- failure feature_not_enabled_by_default: package feature is not enabled by default ---

Description:
A feature is no longer enabled by default for this package. This will break downstream crates which rely on the package's default features and require the functionality of this feature.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#cargo-feature-remove-another
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/feature_not_enabled_by_default.ron

Failed in:
  feature tokio in the package's Cargo.toml

If the breaking changes are intentional then everything is fine - this message is merely informative.

Remember to apply a version number bump with the correct severity when publishing a version with breaking changes (1.x.x -> 2.x.x or 0.1.x -> 0.2.x).

@AdomasBekeras
Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree company="Microsoft"

@AdomasBekeras AdomasBekeras marked this pull request as ready for review March 27, 2026 09:16
Copilot AI review requested due to automatic review settings March 27, 2026 09:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes anyspawn::Spawner and anyspawn::JoinHandle available to downstream crates without requiring them to enable runtime features themselves, by removing feature-gating around the modules/exports and adjusting crate defaults and tests accordingly.

Changes:

  • Removed tokio/custom feature gates around Spawner/JoinHandle modules and re-exports so the types are always available.
  • Changed anyspawn default features to empty, and added “unconstructable” enum variants to keep types compiling when no runtime features are enabled.
  • Moved integration test gating from #[cfg(feature = ...)] in test code to required-features entries in Cargo.toml.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
crates/anyspawn/tests/spawner.rs Removes per-test feature cfgs now that test enabling is controlled via required-features.
crates/anyspawn/tests/handle.rs Removes feature gating in favor of required-features.
crates/anyspawn/tests/builder.rs Removes file-level feature gating in favor of required-features.
crates/anyspawn/src/spawner.rs Adds a no-feature-only SpawnerKind::None variant and match arms to keep compilation working without runtime features.
crates/anyspawn/src/lib.rs Removes feature gating around handle/spawner modules and exports so types are always available.
crates/anyspawn/src/handle.rs Adds a no-feature-only JoinHandleInner::None variant and adjusts poll to compile cleanly under different feature sets.
crates/anyspawn/Cargo.toml Sets default = [] and adds required-features for tests/benches/examples.
Cargo.lock Removes tick from the resolved dependency graph for this crate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@martintmk martintmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please address relevant copilot comments

Agent-Logs-Url: https://github.com/microsoft/oxidizer/sessions/de7617ea-40d8-46bd-ab08-1adf6b7bbb65

Co-authored-by: AdomasBekeras <20183755+AdomasBekeras@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

I suggest to also have empty default features.

Empty default features (default = []) are already set in Cargo.toml (added in commit 5d62209).

Copilot AI review requested due to automatic review settings March 27, 2026 10:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 27, 2026 11:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

crates/anyspawn/tests/handle.rs:14

  • With JoinHandle now available without any runtime feature, it would be useful to add a non-Tokio integration test that exercises the custom JoinHandle variant (e.g., created via Spawner::new_custom and awaited via futures::executor::block_on). As written, this test only runs under the tokio feature (via Cargo.toml gating), so the default featureless build won’t cover the Custom join-handle behavior or its Debug output.
#[cfg_attr(miri, ignore)]
#[tokio::test]
async fn join_handle_debug() {
    let spawner = Spawner::new_tokio();
    let handle = spawner.spawn(async { 42 });

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AdomasBekeras AdomasBekeras merged commit 0ebcc2d into main Mar 27, 2026
27 checks passed
@AdomasBekeras AdomasBekeras deleted the u/abekeras/make_spawner_usable_with_no_features branch March 27, 2026 12:13
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.

5 participants