- Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.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.
Description
For some reason FnMutFut<&'any BAZ::Param, ()>
is not being inferred as FnMutFut<&'any i32, ()>
, which results in an unsatisfied trait bound error.
use std::future::Future; pub trait Baz { type Param; } pub trait FnMutFut<P, R>: FnMut(P) -> Self::Future { type Future: Future<Output = R>; } impl<P, F, FUT, R> FnMutFut<P, R> for F where F: FnMut(P) -> FUT, FUT: Future<Output = R>, { type Future = FUT; } pub async fn does_not_work<BAZ>(_: BAZ, mut cb: impl for<'any> FnMutFut<&'any BAZ::Param, ()>) where BAZ: Baz<Param = i32>, { cb(&1i32).await; }
Perhaps something involving the generic implementation of FnMutFut
? Perhaps something involving impl trait
?
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.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.