Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: waker_ref and ArcWake only available on alloc #147

Merged
merged 1 commit into from
Dec 15, 2024

Conversation

jgraef
Copy link
Contributor

@jgraef jgraef commented Dec 14, 2024

I'm using async-tungstenite as dependency and my builds recently started failing. I get the following error message:

error[E0432]: unresolved imports `futures_task::waker_ref`, `futures_task::ArcWake`
  --> /home/emma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-tungstenite-0.28.1/src/compat.rs:9:20
   |
9  | use futures_task::{waker_ref, ArcWake};
   |                    ^^^^^^^^^  ^^^^^^^ no `ArcWake` in the root
   |                    |
   |                    no `waker_ref` in the root
   |
note: found an item that was configured out
  --> /home/emma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-task-0.3.31/src/lib.rs:37:5
   |
37 | mod waker_ref;
   |     ^^^^^^^^^
note: the item is gated behind the `alloc` feature
  --> /home/emma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-task-0.3.31/src/lib.rs:36:7
   |
36 | #[cfg(feature = "alloc")]
   |       ^^^^^^^^^^^^^^^^^
note: found an item that was configured out
  --> /home/emma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-task-0.3.31/src/lib.rs:40:28
   |
40 | pub use crate::waker_ref::{waker_ref, WakerRef};
   |                            ^^^^^^^^^
note: the item is gated behind the `alloc` feature
  --> /home/emma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-task-0.3.31/src/lib.rs:39:7
   |
39 | #[cfg(feature = "alloc")]
   |       ^^^^^^^^^^^^^^^^^
note: found an item that was configured out
  --> /home/emma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-task-0.3.31/src/lib.rs:26:26
   |
26 | pub use crate::arc_wake::ArcWake;
   |                          ^^^^^^^
note: the item is gated behind the `alloc` feature
  --> /home/emma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-task-0.3.31/src/lib.rs:25:7
   |
25 | #[cfg(feature = "alloc")]
   |       ^^^^^^^^^^^^^^^^^

Weirdly enough I could not reproduce this by compiling async-tungstenite (with --no-default-features). But creating a new crate with the following will produce the error:

async-tungstenite = { version = "0.28.1", default-features = false }

and adding another dependency to enable the feature will fix it:

futures-task = { version = "0.3.31", default-features = false, features = ["alloc"] }

Looking at the source code of futures-task, waker_ref and ArcWake indeed require the alloc feature to be enabled. This PR fixes this.

@sdroege sdroege merged commit 760b512 into sdroege:main Dec 15, 2024
8 checks passed
@sdroege
Copy link
Owner

sdroege commented Dec 15, 2024

Released as 0.28.2, thanks!

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.

2 participants