Closed
Description
Currently tuples can contain unsized types, but cannot be coerced.
It contrasts with behavior of tuple structs and probably should be changed.
I can see two options here:
a) Forbid tuples with unsized types completely.
b) Forbid tuples with unsized types on any but last position and allow DST coercions.
struct S;
trait T {}
impl T for S {}
struct Wrapper<TT: ?Sized>(i32, TT);
fn main() {
let sw: Wrapper<S> = Wrapper(0, S);
let tw: &Wrapper<T> = &sw; // unsizes just fine
let st: (i32, S) = (0, S);
let tt: &(i32, T) = &st; // fails to unsize, even though it could
}
// on a side note, why is it a legal type?
// as far as I can tell there is no way to get
// an instance of this type right now
type Why = (T, i32);