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
IIRC from the last time this came up, the data used by these intrinsics isn't available until the translation pass, long after const-expansion, and because of things like arrays, where you can use a const fn for the size, it becomes a chicken-or-egg problem. Imagine if you had something like this:
typeMyArray = [i32;size_of::<MyArray>];
Of course, you could paper over this by making it an error to do something like this, but that would require an RFC.
@abonander You are right. If we want to do this, we need to add a constrain to size_of and size_of_val to make them only accept "concrete" types (i.e. types with known size). If it's related to the compilation passes then I think we need to listen to some rustc gurus.
This allows using
size_of
andsize_of_val
in constants contexts. Does this need an RFC?The text was updated successfully, but these errors were encountered: