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.
The text was updated successfully, but these errors were encountered:
I think this is related to a change @nikomatsakis made, where unrestricted type variables, rather than raising an error, are silently converted to _|_. I've had similar problems with it, where I got strange errors when casting things to iface types. I think we should probably make this an error again.
I wrote the equivalent of this earlier and it baffled me for several minutes.
It works correctly when you write
sys::size_of::<T>()
. I don't think this should typecheck.The text was updated successfully, but these errors were encountered: