Closed
Description
Tracking bug for implementing DST (I'll file issues for the intermediate steps).
@nick29581 to implement, @nikomatsakis to write an RFC for the RFC repo.
Nominating 1.0 (I think its already been discussed and agree that this blocks 1.0, if someone could tag this, it would be great).
Sub-bugs:
- Add the unsized keyword #12969: Add the unsized keyword
- Remove the
Sized
kind #13120: Remove theSized
kind - Allow the last field of a struct to be a DST #13121: Allow the last field of a struct to be a DST
- Remove hack around requiring
Sized
bound in collect.rs #13367: Remove hack around requiringSized
bound in collect.rs - Prevent storing and passing DST values #13376: Prevent storing and passing DST values
- Refactor ty_vec, avoiding vstore #13554: Refactor ty_vec, avoiding vstore
- Allow coercions from statically sized to dynamically sized arrays #13716: Implement coercion rules from
&[T, ..n]
to&[T]
, etc. - Refactor ty_str to use a ~(str) representation. #13819: Refactor ty_str, avoiding vstore (follow up (Remove internal support for fixed length strings #13834) - remove size field from ty_str)
- Apply coercion rules on return expressions #12755: Coerce return values (needed for DST
&[T]
literals) - Remove TraitStore from ty_trait #14869: Refactor ty_trait, avoiding tstore
- Change DST syntax: type -> Sized? #15521 Implement syntax for unsized types. Currently
Sized?
looks like the favourite - DST raw pointers - *-pointers are fat pointers #16805 fat raw pointers
- Unify unsized types in type inference #17178 unify [T] with U in type inference (needs refactoring a lot of the libs, and/or trait reform, see DST-ification of libraries #16918) - turns out we really need this. Doing anything non-trivial with DST requires it. I had hoped we could get away without for a while but that does not seem to be the case.
- DST: trait objects should automatically implement the trait #19187 DST: trait objects should automatically implement the trait
Tasks which don't yet have issues
- Add fat pointers to trans
- Indexing into fat pointer types in trans
- remove all the hackey support for old behaviour (where we treat
&[T]
differently from&([T])
) - structs
- recursive coercions (pointers in structs) - needs some design work (DST/custom coercions #18598, part of Implement revised coercion rules #18469)
- strings (but can only be instantiated using transmute)
- traits
- use DST coercions for receiver when doing trait/method search (leaving this till post- NIko's cleanup of everything trait related, if we want to do it at all).
- properly deal with type aliases which are traits (i.e., accept them everywhere a trait is accepted). I don't actually think there is anything legitimate to do here - type = Trait... works and can be used anywhere a trait type could be used. It would be wrong to use a type, even an alias to a trait type where a trait is expected