2 ms·
Rust has unsized (aka dynamically-sized) types, trait objects and slices are probably the most commonly encountered DSTs. There are two main limitations to the
by masklinn 10y ago
Rust has unsized (aka dynamically-sized) types, trait objects and slices are probably the most commonly encountered DSTs.
There are two main limitations to them:
* by default most generic code can not operate over them, generics require the special `?Sized` bound to allow DSTs (essentially generics have a default Sized generic bound)
* Rust doesn't currently support dynamic stack allocation so DSTs can't be stack-allocated (https://github.com/rust-lang/rfcs/issues/618 https://github.com/rust-lang/rfcs/issues/618)