You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I initially didn't have the Borrow impl, so the foo.get line was unambiguous. When I added the impl, that line became ambiguous, because the .into() could mean into Label or into String. I expected the compiler to report that; instead, I got a nonsensical error on the following line:
error[E0283]: type annotations needed for `(&Label, &())`
--> src/main.rs:20:29
|
20 | let _ = foo.iter().map(|(k, v): (&Label, _)| ()).count();
| ^^^^^^ consider giving this closure parameter the explicit type `(&Label, &())`, where the type parameter `Label` is specified
|
= note: cannot satisfy `Label: std::borrow::Borrow<_>`
Note how it mentions Borrow even though nothing needs Borrow on that line. Note also how it asks for a concrete type even though it is already concrete.
Meta
I originally got the error on stable but it fails in the playground on nightly too.
The text was updated successfully, but these errors were encountered:
I thought it was specific to HashMap and Borrow but it doesn't look like it anymore. It fails even when there is no link between the two lines at all. There's something about using the same type twice where one is ambiguous somehow.
I tried this code (playground):
I initially didn't have the
Borrow
impl, so thefoo.get
line was unambiguous. When I added the impl, that line became ambiguous, because the.into()
could mean intoLabel
or intoString
. I expected the compiler to report that; instead, I got a nonsensical error on the following line:Note how it mentions
Borrow
even though nothing needsBorrow
on that line. Note also how it asks for a concrete type even though it is already concrete.Meta
I originally got the error on stable but it fails in the playground on nightly too.
The text was updated successfully, but these errors were encountered: