-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
impl-trait return type is bounded by all input type parameters, even when unnecessary #42940
Copy link
Copy link
Open
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-bugCategory: This is a bug.Category: This is a bug.F-precise_capturing`#![feature(precise_capturing)]``#![feature(precise_capturing)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-asyncWorking group: Async & awaitWorking group: Async & await
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-bugCategory: This is a bug.Category: This is a bug.F-precise_capturing`#![feature(precise_capturing)]``#![feature(precise_capturing)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-asyncWorking group: Async & awaitWorking group: Async & await
Type
Fields
Give feedbackNo fields configured for issues without a type.
Since
SomeFutureborrows'a Client, I'd expectimpl Future + 'ato be the correct return type, but it gives this error:Changing
_bodyto have an explicit lifetime like_body: &'b Bwhere'bis independent of'aor where'a: 'bdoes not change the error. This and the original error make it seem that returning animpl traitis somehow causing the_bodyparameter to get the'alifetime, even though it's clearly unused, let alone used in a way that it would require the'alifetime.Changing
(1)fromimpl Future + 'atoSomeFuture<'a>fixes it.Changing
(1)fromimpl Future + 'atoBox<Future + 'a>and returningBox::new(SomeFuture(self))fixes it.