Confusing error messages (a closure can't be cloned) #37736
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Trying to filter and then clone an Iterator over the
chars
in&str
, I'm getting an error message that was pretty opaque (at least to me).Code
Error
It'd be nice if this error gave more info about how to fix the problem (the fix seems to be to change L1 from
let f = |c: &char|
tolet f = &|c: &char|
).Sorry if this is a duplicate, I couldn't find anything obvious.
EDIT: What I'm trying to do is to make sure there are at least three digits in my Iterator before I actually collect it, I suspect the right answer isn't changing the filter closure (I'm not sure why that fixes the compiler error tbh), but using something else instead of
iter.clone()
.The text was updated successfully, but these errors were encountered: