If I understand correctly regarding localized errors, do you mean that errors such as these:
error[E0308]: mismatched types
--> main.rs:4:10
|
4 | test(&Vec::<u32>::new());
| ^^^^^^^^^^^^^^^^^^ expected u16, found u32
|
= note: expected type `&std::vec::Vec<u16>`
found type `&std::vec::Vec<u32>`
will have std::vec:: removed, provided that Vec can translate only to std::vec::Vec in the scope for which the error is printed? i.e:
error[E0308]: mismatched types
-> main.rs:4:10
|
4 | test(&Vec::<u32>::new());
| ^^^^^^^^^^^^^^^^^^ expected u16, found u32
|
= note: expected type `&Vec<u16>`
found type `&Vec<u32>`
Do you think it is applicable to the current complexity of the type system?
Also, how about adding "where Vec is std::vec::Vec"?
error[E0308]: mismatched types
--> main.rs:4:10
|
4 | test(&Vec::<u32>::new());
| ^^^^^^^^^^^^^^^^^^ expected u16, found u32
|
= note: expected type `&Vec<u16>`
found type `&Vec<u32>` where `Vec` is `std::vec::Vec`
A little secret - when I get type errors upon passing a value of a complex type to a new function, I sometimes put () temporarily as the type of a parameter, just for letting rustc to print the full type. Then I copy the full type to the declaration and remove the unneeded paths (or prefix them with :: if I’m lazy). Sort of like a type hole in GHC. It would be nice if rustc will shorten the paths for me 