-
-
Notifications
You must be signed in to change notification settings - Fork 17.6k
for<'a> Fn(<A as B<'a>>::C) fails incosistently and requires unnecessary type annotations #90875
Copy link
Copy link
Closed
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-inferenceArea: Type inferenceArea: Type inferenceA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-trait-systemArea: Trait systemArea: Trait systemA-type-systemArea: Type systemArea: Type 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
Activity
Metadata
Metadata
Assignees
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-inferenceArea: Type inferenceArea: Type inferenceA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-trait-systemArea: Trait systemArea: Trait systemA-type-systemArea: Type systemArea: Type 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.
I tried this code:
(playground)
I expected to see this happen: the code compiles fine.
Instead, this happened:
check(fn_1)andcheck(fn_4)fails to type check, and although the error message is not related to type inference, annotating the type parameterTfixes the problem. the same thing happens when removing the boundF: Fn(T), but then for allcheck(fn_*).Seems to be related to #79207. cc @jackh726
Error message
Context
Original thread in users forum
Meta
Tested on
stable andnightly branches of playground:Stable version: 1.56.1