We should change our impls to a DST style where appropriate. E.g., impl Ord for str .... This requires changing a bunch of traits to have the Sized? bound.
This kind of works. The problem is that we currently do not unify T with unsized types ([T], str, etc.) during subtyping/type inference and thus trait matching. This means that if do the DST-ification, we will fail to type check in places with references (e.g., a == b where a and b both have type &str). However, if we do unify, we will get coherance errors where impls are defined for, e.g., &T and &str. Thus we have a bit of a catch 22. We could cfg our way to victory, but there are literally hundreds of places that need DST-ification, so that will be extremely painful. I'm not sure if trait reform landing can help us here, or perhaps where clauses with != constraints or something equally exotic. Perhaps we could hack coherance with this special case temporarily. Anyway, we need a plan!
cc @nikomatsakis
We should change our impls to a DST style where appropriate. E.g.,
impl Ord for str .... This requires changing a bunch of traits to have theSized?bound.This kind of works. The problem is that we currently do not unify
Twith unsized types ([T],str, etc.) during subtyping/type inference and thus trait matching. This means that if do the DST-ification, we will fail to type check in places with references (e.g.,a == bwhereaandbboth have type&str). However, if we do unify, we will get coherance errors where impls are defined for, e.g.,&Tand&str. Thus we have a bit of a catch 22. We could cfg our way to victory, but there are literally hundreds of places that need DST-ification, so that will be extremely painful. I'm not sure if trait reform landing can help us here, or perhaps where clauses with!=constraints or something equally exotic. Perhaps we could hack coherance with this special case temporarily. Anyway, we need a plan!cc @nikomatsakis