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
The purpose of this feature is to add a new inlay hint at the end of each type with its size and padding. When a type (a struct, an enum, etc) is bigger than a pointer, it is more efficient to pass it by reference where possible to avoid large copies. In rust this needs special attention since it is not very stack-efficient. This feature is trivial to implement, as the compiler already provides all the information required. In enums and structs, this could be added to every variant/field. The feature could also be extended to function arguments in function declarations.
Current solution
Manually calculating it or using -Zprint-type-sizes. Both are very cumbersome, the latter specially in files with lots of types, like massive lib.rss.
Possible settings
Enable/Disable, obviously.
Unit: bytes or bits. I would default to bytes, but personally I prefer bits.
Size threshold: Only show for types bigger than a given size. A good default would be to show for size > sizeof(usize).
Remove padding and size as separate labels and show the whole size in a single number. I actually think this should be the default.
The text was updated successfully, but these errors were encountered:
Description
The purpose of this feature is to add a new inlay hint at the end of each type with its size and padding. When a type (a struct, an enum, etc) is bigger than a pointer, it is more efficient to pass it by reference where possible to avoid large copies. In rust this needs special attention since it is not very stack-efficient. This feature is trivial to implement, as the compiler already provides all the information required. In enums and structs, this could be added to every variant/field. The feature could also be extended to function arguments in function declarations.
Current solution
Manually calculating it or using
-Zprint-type-sizes
. Both are very cumbersome, the latter specially in files with lots of types, like massivelib.rs
s.Possible settings
size > sizeof(usize)
.The text was updated successfully, but these errors were encountered: