feat(anyspawn): Make Spawner usable without features#343
feat(anyspawn): Make Spawner usable without features#343AdomasBekeras merged 13 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
I suggest to also have empty default features. |
|
|
@microsoft-github-policy-service agree company="Microsoft" |
There was a problem hiding this comment.
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/customfeature gates aroundSpawner/JoinHandlemodules and re-exports so the types are always available. - Changed
anyspawndefault 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 torequired-featuresentries inCargo.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.
martintmk
left a comment
There was a problem hiding this comment.
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>
Empty default features ( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
JoinHandlenow available without any runtime feature, it would be useful to add a non-Tokio integration test that exercises the customJoinHandlevariant (e.g., created viaSpawner::new_customand awaited viafutures::executor::block_on). As written, this test only runs under thetokiofeature (via Cargo.toml gating), so the default featureless build won’t cover theCustomjoin-handle behavior or itsDebugoutput.
#[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.
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