Type inference fails to infer the type of a closure when calling a function with an argument bounded by a trait implemented for a closure which takes a reference argument #24735
Labels
A-closures
Area: Closures (`|…| { … }`)
This code fails to compile:
Error message:
This error can be solved by explicitly annotating the type of the closure:
This problem does not arise when the argument to the closure is not behind a reference:
This error first observed in @brson's blog "httptest" blog post: https://github.com/brson/httptest#4-mutation , where it is described as a bug in type inference rather than an inherent limitation of the type system.
The text was updated successfully, but these errors were encountered: