- The
size_of_val and align_of_val declarations are now incorrect; they should take T: DynamicallySized , as opposed to T: ?Sized .
Is this a breaking change ?
All other points are just nitpicks that you might want to improve for the RFC. Thank you a lot for working on this. This is great.
In the Foo example, size_of_val(&foo) result appears incorrect (the size of usize is missing) - would be cool to work out this example fully for the RFC.
Are std::raw::ptr and std::raw::ptr_mut necessary? You can get this behavior with as.
You just said they arenât, so why add them ? People should be using as for this already, so I think it would be better to just add an example that shows that as just works.
How should these thick pointers be passed, if they are larger than two pointers?
IIUC these donât have to be C FFI safe for the short-term goals of the RFC, so we would be talking here about repr(Rust) only. I donât see any reason why these couldnât be passed as aggregates with an unspecified layout. After the RFC, we could specify these further as part of the unsafe code guidelines, but this does not have to be done right now.
we will also introduce four functions into the standard library, in std::raw:
I donât see any reason to put these in libstd and not libcore, so that should probably be core::raw
Flexible Array Members
In the introduction you might want to mention â(similar to C VLAs)â since VLAs is what people know, but FAM is probably a too technical term, for the introduction at least. Linking the FAM paper (and C VLAs) from the introduction might be worth it.
indexing and slicing 2-d arrays
If you need more examples, you can add one for writing a DST for 2d arrays - that shouldnât be too hard. If you want to mention more use cases, multi-dimensional slices in general, and maybe âgrowableâ slices (e.g. a slice into a growable Vec/ArrayVec/SmallVec with fixed-capacity).
Prior art
I know you are aware of all previous RFCs on this topic, so you might want to reference some of that here. In particular, the last RFC about this, and @nikomatsakis comments about it at the end, and maybe address what has changed.