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

lifetime bound when returning impl Trait is not considered #98719

Closed
estaban opened this issue Jun 30, 2022 · 3 comments
Closed

lifetime bound when returning impl Trait is not considered #98719

estaban opened this issue Jun 30, 2022 · 3 comments
Labels
A-impl-trait Area: impl Trait. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estaban
Copy link

estaban commented Jun 30, 2022

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

@Rageking8
Copy link
Contributor

@rustbot label C-bug T-compiler

@rustbot rustbot added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 30, 2022
@aliemjay
Copy link
Member

aliemjay commented Jul 2, 2022

Duplicate of #42940.

@rustbot label A-impl-trait

@rustbot rustbot added the A-impl-trait Area: impl Trait. Universally / existentially quantified anonymous types with static dispatch. label Jul 2, 2022
@tamird
Copy link
Contributor

tamird commented Sep 16, 2023

@aliemjay should this be closed as duplicate?

@aliemjay aliemjay closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: impl Trait. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants