Re:Rust 1.37.0
by oconnor663 on Thursday August 15, 2019 @02:30PM
(#20708193)
The hack that I've seen people use the most is to write a line like this:
Then rustc will print out an error that includes the type of `foo`.
[ Parent
| on HN ]
Scott Meyers also suggests the same sort of thing in Effective Modern C++ when not using an IDE.
Personally, I use the technique a lot for debugging template errors in the language.
Re:Rust 1.37.0
by stochastic_monk on Thursday August 15, 2019 @03:06PM
(#20708549)
Specifically:
template<typename T> struct TD;
Instantiate this as ‘TD<decltype(foo)>’ to get the full name of the type.
Rust’s does seem more concise.
Re:Rust 1.37.0
by edflsafoiewq on Thursday August 15, 2019 @04:45PM
(#20709470)
Note that you don't get the full name of the type with a bad assignment in Rust, you only get the part of the type that was deduced before type checking failed. A generic type might have undeduced blanks, eg. Vec<_>. A side-effect of type inference.