LinearMap is quite a bit faster, and is fully owned/sendable without
requiring copies. The older std::map also doesn't use explicit self and
relies on mutable fields.
Changes:
- Refactor move mode computation
- Removes move mode arguments, unary move, capture clauses
(though they still parse for backwards compatibility)
- Simplify how moves are handled in trans
- Fix a number of illegal copies that cropped up
- Workaround for bug involving def-ids in params
(see details below)
Future work (I'll open bugs for these...):
- Improve error messages for moves that are due
to bindings
- Add support for moving owned content like a.b.c
to borrow check, test in trans (but I think it'll
"just work")
- Proper fix for def-ids in params
Def ids in params:
Move captures into a map instead of recomputing.
This is a workaround for a larger bug having to do with the def-ids associated
with ty_params, which are not always properly preserved when inlining. I am
not sure of my preferred fix for the larger bug yet. This current fix removes
the only code in trans that I know of which relies on ty_param def-ids, but
feels fragile.
1. In the first case, the previous code was failing during type inference
due to mismatched structure. Fix is to use the X structure at both
points in the code.
2. In the second case, a naive transcription that subsitutes *nothing*
in for the omitted statements signified by "..." will actually
compile without an error. Furthermore, any pure code could also be
substituted for the ellipsis and the code would compile (as the
text already states). So to make the example more illustrative, it
would be better to include an impure callback, which makes the
potential for aliasing immediately obvious to the reader.
1. The section on trait definitions of static methods should include
a trait with a static method in the generated document.
2. The section on trait inheritance had a expression that appears
nonsensical ("let mycircle = @mycircle") in the generated document.
The text would be clearer (IMO) if we continued with the running
example of CircleStruct.