News for hackers. Stuff that matters.
Re:Rust's 2017 roadmap, six months in by Lerc on Wednesday July 05, 2017 @10:25PM (#14707740)
How do you find out what the compiler says for the return type? Is that covered in the book somewhere? I feel like this might help me quite a bit in my struggles.
Re:Rust's 2017 roadmap, six months in by bbatha on Wednesday July 05, 2017 @10:31PM (#14707759)
I commonly let the compiler error out by specifying the wrong type or leaving off a type annotation. For instance, https://is.gd/8lLrY8
Re:Rust's 2017 roadmap, six months in by steveklabnik on Wednesday July 05, 2017 @11:15PM (#14707922)
one way is to do

    return SOME_EXRPRESSION;
and then look at the compiler error. Another way is

    let () = SOME_EXPRESSION;
which works as long as SOME_EXPRESSION is not of type (), but if it compiles, well, you know the type :)

Another way is to use some sort of IDE integration that gives you "show me the type on hover".