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
I wrote the equivalent of this earlier and it baffled me for several minutes.
fn size_of<T>() -> uint {
// Expecting (though unreasonably) the type parameter to be
// inferred to T, it is actually inferred to something byte-sized (nil?)
sys::size_of()
}
fn main() {
// Why does size_of::<u32>() return 1?
assert size_of::<u32>() == 4u;
}
It works correctly when you write sys::size_of::<T>(). I don't think this should typecheck.