We should probalby warn when defining a method foo on {foo: int} etc.
This should reduce the amount of useless typevars that are allocated.
Issue #1227
See src/test/run-pass/nested-patterns.rs for some examples. The syntax is
boundvar@subpattern
Which will match the subpattern as usual, but also bind boundvar to the
whole matched value.
Closes#838
There's no good reason to force them to be spilled anymore. Some
pieces of trans become more elegant this way, and less stack allocs
and load/stores are needed.
Issue #1021
Local values that are not mutated, don't need to be cleaned up, and
are immediate, don't need to be spilled. (All immediate args, and
non-pointer immediate let locals.)
Issue #667
Wires in a basic framework for destination-passing style, with
backwards-compatibility to the old approach, so that expression types
can be moved over to it one at a time (by moving them from trans_expr
to trans_expr_dps).
The builder functions in trans_build now look at an 'unreachable' flag
in the block context and don't generate code (returning undefined
placeholder values) when this flag is set. Threading the unreachable
flag through context still requires some care, but this seems a more
sane approach than re-checking for terminated blocks throughout the
compiler.
When creating a block, if you use its closest dominator as parent, the
flag will be automatically passed through. If you can't do that,
because the dominator is a scope block that you're trying to get out
of, you'll have to do something like this to explicitly pass on the
flag:
if bcx.unreachable { Unreachable(next_cx); }
Closes#949. Closes#946. Closes#942. Closes#895. Closes#894.
Closes#892. Closes#957. Closes#958.
trans::type_of now has a constraint saying that its type argument
is statically sized. This eliminates the "impossible happened" case
in type_of. Yay!
I note that this change decreased translation time for stage2/rustc
from 16.1 s to 14.0 s. I also think many of the remaining checks
could be eliminated with some mildly clever use of constrained types
and further preconditions. Future work!
Experimenting with adding typestate constraints in the compiler.
Added a constraint to GEP_tag that says the variant index is in
bounds. Added necessary checks.