-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
“closure references itself” error when it’s not #97680
Copy link
Copy link
Open
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-inferenceArea: Type inferenceArea: Type inferenceA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-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.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-inferenceArea: Type inferenceArea: Type inferenceA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-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.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code (playground):
Trying to compile it produces the following error:
I’m not sure if it should compile, but the diagnostic is misleading either way: this closure doesn’t have infinite size (in fact, it’s zero-sized), doesn’t capture itself (it captures nothing) and doesn’t take itself as argument (it only takes
()).I don’t see a reason why it shouldn’t compile though, since all the types are known without evaluating the recursive bound on
hrc().Meta
This bug is reproducible on playground on stable, beta and nightly (1.61.0, 1.62.0-beta3 and 1.63.0-nightly (2022-06-02 e714405) respectively)
Links