Closed
Description
The following code compiled with Rust dc4560d:
use Set = std::hashmap::HashSet;
fn main() {
let set : Set<int> = Set::new();
set.contains(&3);
let _ = set;
}
fails to compile with the following message:
/tmp/test2.rs:5:4: 5:21 error: type `std::hashmap::HashSet<int>` does not implement any method in scope named `contains`
/tmp/test2.rs:5 set.contains(&3);
^~~~~~~~~~~~~~~~~
With the help of the wonderful folks on #rust
, I was able to determine that the reason is isn't working is that the Set
trait is being masked by my alias for std::hashmap::HashSet
. I think that the compiler should emit a warning or error to explain what's going on.
Metadata
Metadata
Assignees
Labels
No labels