I recently came across the following code. It does compile in rust 1.11 (if you omit the function body), but I think it's really strange. I don't know if something like this should be allowed.
trait MyTrait<T> {
fn func(p: &T);
}
struct MyStruct { }
impl<bool> MyTrait<bool> for MyStruct {
fn func(p: &bool) {
let mut v: Vec<bool> = Vec::new();
v.push(true); // error
}
}
This leads to confusing compile errors such as:
expected type
bool
found typebool
I am aware that this can only happen to a newbie.