Skip to content

Type mismatch with async block to dyn Future coercion #11815

Closed
@Veykril

Description

@Veykril
use core::future::Future;
use core::pin::Pin;

// expected Pin<Box<dyn Future<Output = ()> + Send, Global>>, found Pin<Box<impl Future<Output = ()>, Global>>
fn send() -> Pin<Box<dyn Future<Output = ()> + Send + 'static>> {
    Box::pin(async move {})
}

// expected Pin<Box<dyn Future<Output = ()>, Global>>, found Pin<Box<impl Future<Output = ()>, Global>>
fn not_send() -> Pin<Box<dyn Future<Output = ()> + 'static>> {
    Box::pin(async move {})
}

high priority as this affects all uses of async_trait

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tytype system / type inference / traits / method resolutionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions