Skip to content

Allow projection in const functions #364

@jacobsa

Description

@jacobsa

When I try to use a project_ref method in a const function I get an error:

error[E0015]: cannot call non-const method `union::_::<impl union::Running<F>>::project_ref` in constant functions
   --> storage/m5/async/task.rs:558:71
    |
558 |                 let future: Pin<&PinnedUnsafeCell<F>> = running_state.project_ref().future;
    |                                                                       ^^^^^^^^^^^^^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants

Is it possible to support this? It doesn't seem like there would be anything in the projection logic that can't itself be const.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-pin-projectionArea: #[pin_project]C-enhancementCategory: A new feature or an improvement for an existing one

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions