Closed
Description
We must forbid storing or passing DST values. I.e., DST values may not be l-values.
The following should be illegal:
fn g<type X>(x: X) {...}
fn f(x: ~[T]) {
let y = *x; //~ERROR lvalue is dynamically sized
g(*x); //~ERROR lvalue is dynamically sized
}
I think we can enforce this by preventing storage locations having DST, rather than checking de-references.
Note that pointers to DST values are themselves sized, so may be lvalues. As a follow-up, we may allow DST values to be passed as arguments, but that will involve some pretty gross hacks.
We already prevent DST values being stored in fields.
Metadata
Metadata
Assignees
Labels
No labels