You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
t.rs:2:13: 2:16 error: unable to infer enough type information about `_`; type annotations or generic parameter binding required [E0282]
t.rs:2 fn main() { foo() }
^~~
It should, at least, mention T by name, and I think some rewording would also be beneficial.
The text was updated successfully, but these errors were encountered:
It doesn't matter that T isn't used. This also triggers the error:
fnfoo<T>(){println!("The size of T is {}", std::mem::size_of::<T>());}fnmain(){foo()}
At the call site it has to monomorphize foo<T>() but it cannot infer for T. You need to provide foo, at the very least, with a type parameter, like so:
whitequark
changed the title
unhelpful error message invoking fn foo<T>() when T is never used
unhelpful error message invoking fn foo<T>() when T is not used within signature
Sep 20, 2015
Test case:
Error:
It should, at least, mention
T
by name, and I think some rewording would also be beneficial.The text was updated successfully, but these errors were encountered: