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
But the error is extremely confusing (and doesn't get any better if you split the code apart into multiple lines and add type annotations):
equals.rs:13:36: 13:39 error: mismatched types: expected `&const <V41>` but found `'a` (expected &-ptr but found type parameter)
equals.rs:13 vec::find(self, |e| {e.first() == key}).is_some()
^~~
equals.rs:13:23: 13:39 error: cannot determine a type for this bounded type parameter: unconstrained type
equals.rs:13 vec::find(self, |e| {e.first() == key}).is_some()
^~~~~~~~~~~~~~~~
That's quite a bit better: at least it points you to the operator having problems. My understanding is that it is an error because arbitrary generic types cannot be equated. You need to constrain them with the Eq trait which the code above does not do.
Activity
catamorphism commentedon Dec 7, 2012
This is slightly better ( with d2ad028 ) but I still don't understand why this is the error:
jesse99 commentedon Dec 7, 2012
That's quite a bit better: at least it points you to the operator having problems. My understanding is that it is an error because arbitrary generic types cannot be equated. You need to constrain them with the Eq trait which the code above does not do.
pcwalton commentedon Mar 23, 2013
Closing.
Merge pull request rust-lang#3480 from sinkuu/cleanup
Auto merge of rust-lang#3480 - RalfJung:alloc_error_handler, r=RalfJung
Merge rust-lang#3480