Description
The std::raw
module exports some representation details for the purposes of transmuting and taking things apart. Stabilizing these means pinning down the representation details forever.
One possibility is to instead provide various conversions, rather than asking people to use transmute
, when we're sure the conversions will always be possible. Methods like from_raw_parts
are already doing this.
The TraitObject
case in particular is unsettled due to the potential for upcasting in the future.
cc @carllerche
CURRENT STATUS AS OF 2016-08-18: Discussed in @rust-lang/lang meeting. The situation is this. We expect that this will be insufficient in the future, particularly if/when we support trait objects like Trait1+Trait2 (which would require 2 vtables). We could stabilize it, since it would remain correct for all existing objects, but it'd be a shame. In contrast, the various "custom DST" proposals would allow for a much more flexible way of extracting and creating this data (sort of like from_raw_parts), so we think we'd prefer to explore that route. (from #27751 (comment))