Skip to content

lifetime bound when returning impl Trait is not considered #98719

Closed as not planned
@estaban

Description

@estaban

Lifetimes bounds added to returned impl Trait does not seem to be considered by the compiler.

Example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=02f184ddb3ce9d04c049c93c9d8b25b5

I would expect the above example to compile: wrap is defined to return a 'static Future, so why is the compiler saying that it should have the same lifetime as &self ?

The issue does not manifest when returning a concrete type like MapErr or BoxFuture<'static, Reply>,

@LucioFranco

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions