Skip to content

Support for no_std targets without atomics extension #2953

Open
@renkenono

Description

@renkenono

Hello,

First of all, thank you for your work on futures.

I'm working on a project targeting various ESP32 microcontrollers using esp-hal, a few of them e.g., esp32c3, do not have support for atomics and therefore no access to core::sync::atomic and alloc::sync::{Arc, Weak}.

The idea is to evaluate what needs to be done to support most if not all sub-crates of futures on such platforms. This is commonly achievable using the portable-atomic and portable-atomic-util crates which is what futures_core offers behind the portable-atomic feature.

I'd like your insights on offering a common Arc implementation that can be used over all of futures' sub-crates, mainly futures-task/src/waker.rs and futures-task/src/arc_wake.rs.

Something to keep in mind,portable-atomic-util extends portable-atomic with alloc-related functionalities which could theoretically be feature-gated by alloc itself. However, I am not sure if cargo's features system would allow us to selectively enable either alloc by itself or alloc and portable-atomic-util dependency if both alloc and portable-atomic are enabled.

This issue might also require a nightly compiler mainly to enable #![feature(arbitrary_self_types)].

In attempt to implement this, I realized that tests can be hard to follow as futures is used as a dev dependency instead of the individual sub-crates, but this is not a blocking issue.

Related work

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions