Commit Graph

5346 Commits

Author SHA1 Message Date
Marijn Haverbeke
575aae407b Saner approach to lvalues and callable values in trans
LValues no longer carry information about generics and objs, instead
there's an extended form of lvalue, lval_maybe_callee, only used by
call and bind, which holds this info.

This makes it possible to take the value of a method and get a working
closure, and will (with some more work) allow us to call statically
known functions without loading from their pair.

Closes #435
Closes #758
2011-09-16 21:31:36 +02:00
Patrick Walton
d9c664e3fa Revert "Revert "Make option::get return the option contents by reference" due to memory corruption"
This reverts commit d1c27ba9e0.
2011-09-16 12:20:06 -07:00
Brian Anderson
679c2d25a1 Un-xfail some task-comm tests 2011-09-16 11:29:40 -07:00
Brian Anderson
4028a099f5 Yield after send 2011-09-16 11:08:01 -07:00
Tim Chevalier
172df2e3a2 Add non_ty_var precondition for type_of_fn, plus minor cleanup 2011-09-16 10:58:02 -07:00
Patrick Walton
469853d5ff rt: Add a new rust_box structure to the runtime that describes a self-describing box 2011-09-16 10:51:59 -07:00
Patrick Walton
f6871e832c rt: Rename rust_box to rust_box_legacy, as they're about to become self-describing 2011-09-16 10:51:58 -07:00
Jesse Ruderman
72317dee0d Fuzzer: update lists of known bugs 2011-09-16 10:44:58 -07:00
Brian Anderson
25394950ae Handle the case where a child task tries to kill a parent while it is dying
Still looks pretty racy
2011-09-16 10:05:12 -07:00
Marijn Haverbeke
ad470d741e Revert "Saner approach to lvalues and callable values in trans"
This reverts commit 66153436c9.
2011-09-16 18:37:46 +02:00
Marijn Haverbeke
133d36f452 Require body of else-less if expressions to be a value-less block
For consistency with other constructs that could not possibly return a
value (say, loops).
2011-09-16 18:21:06 +02:00
Marijn Haverbeke
66153436c9 Saner approach to lvalues and callable values in trans
LValues no longer carry information about generics and objs, instead
there's an extended form of lvalue, lval_maybe_callee, only used by
call and bind, which holds this info.

This makes it possible to take the value of a method and get a working
closure, and will (with some more work) allow us to call statically
known functions without loading from their pair.

Closes #435
Closes #758
2011-09-16 18:21:05 +02:00
Marijn Haverbeke
639d88a693 Move expr_uniq case in trans to a saner place
Note that unique pointers are still broken in more ways than I can count.
2011-09-16 15:03:03 +02:00
Marijn Haverbeke
f8a35234ad Remove autoderef for calls
We were only using it in a single place, and there for no discernable reason
(probably as part of the bare-fn-vals-are-not-copyable plan). It seems more
surprising than useful.
2011-09-16 14:39:30 +02:00
Marijn Haverbeke
c04490d97b Remove unused method_ty field from lval_result 2011-09-16 14:18:49 +02:00
Marijn Haverbeke
fb42d839a0 Clean up (and optimize) root-mutability analysis in alias.rs 2011-09-16 13:46:03 +02:00
Marijn Haverbeke
d7587c1eda Change convention for specifying referenced argument
It is now 1-based, rather than 0 based. (Seems more natural, and allows 0 to
be used to refer to self and maybe to closure.)

Also allows non-referenced args to be implicitly copied again.

Issue #918
2011-09-16 12:42:18 +02:00
Tim Chevalier
059b31f7a3 Actually call unreachable() in impossible case in type_of_inner 2011-09-15 23:22:12 -07:00
Tim Chevalier
57ede5f281 Added non_ty_var precondition to trans::type_of_inner
This allows us to legitimately call unreachable() in the ty_var case.
2011-09-15 23:22:12 -07:00
Jesse Ruderman
ce1877dc8e Add parens, as needed, around else-if conditions. 2011-09-15 21:24:24 -07:00
Tim Chevalier
2c6eba00dd Added an extra check in trans_alt
Gratuitous right now, but I'm going to change the type of trans::type_of
2011-09-15 20:32:01 -07:00
Tim Chevalier
f41f75fe53 Added more predicates in trans
Added the non_ty_var predicate (soon to be used)
Added a check in get_res_dtor (will be necessary for a future change
to type_of_fn)
Removed a gratuitous ret
2011-09-15 20:23:06 -07:00
Tim Chevalier
059952da5b Change a few span_fatals to span_err 2011-09-15 19:51:27 -07:00
Tim Chevalier
994beca00d Add unreachable() fn, also nitpicking 2011-09-15 19:51:27 -07:00
Graydon Hoare
1e3e7d4bc5 Update README slightly. 2011-09-15 16:31:33 -07:00
Graydon Hoare
c94e612ade Begin sketching an ICU binding. Doesn't work yet. 2011-09-15 15:49:17 -07:00
Patrick Walton
18cf4d904c rt: Add libunwind.h support on Mac OS X 2011-09-15 12:52:50 -07:00
Patrick Walton
d1c27ba9e0 Revert "Make option::get return the option contents by reference" due to memory corruption
This reverts commit fc0bf12516.
2011-09-15 12:52:09 -07:00
Marijn Haverbeke
fc0bf12516 Make option::get return the option contents by reference
I can't believe this actually works!
2011-09-15 17:49:29 +02:00
Brian Anderson
906f1fc425 Add regression tests for previously ambiguous syntactic forms 2011-09-15 08:47:23 -07:00
Marijn Haverbeke
7364a8c2b0 Prevent binary expressions from parsing when lhs is non-value block 2011-09-15 17:37:10 +02:00
Marijn Haverbeke
93ba85a0f1 Register new snapshot 2011-09-15 17:33:35 +02:00
Marijn Haverbeke
b843cf2117 Generalize expression roots in alias analysis
This allows calls-returning-a-reference to count as expression roots,
making it possible to return the result of such a call by reference.

Issue #918
2011-09-15 17:01:35 +02:00
Marijn Haverbeke
29177864c3 Add tests for returning by reference
Issue #918
2011-09-15 16:37:37 +02:00
Marijn Haverbeke
3abe3671bd Require the parameter that will be referenced to be noted
Issue #918
2011-09-15 16:15:17 +02:00
Marijn Haverbeke
75eee8b194 Overhaul alias-checking of blocks
The set of active bindings has to be updated as by-reference locals are
encountered.

Issue #918
2011-09-15 15:43:15 +02:00
Marijn Haverbeke
87fa38910e Make storing returned references in a by-reference local work
fn f(a: {x: str}) -> &str {
        ret a.x;
    }

    fn main() {
        let x = {x: "hi"};
        let &y = f(x); // Look ma, no copy!
        log_err y;
    }

Issue #918.
2011-09-15 15:17:14 +02:00
Marijn Haverbeke
25787bd2b8 Forbid assignment to by-reference bindings
Issue #918
2011-09-15 14:08:54 +02:00
Marijn Haverbeke
d7a1d6a1cb Make trans understand by-ref bindings
Issue #918
2011-09-15 14:00:58 +02:00
Marijn Haverbeke
8aad16112b Implement basic checking of by-reference bindings
Issue #918
2011-09-15 13:40:28 +02:00
Marijn Haverbeke
44c6370e6a Move local numbering into ast_map.rs
This further simplifies the alias pass, which is sorely needed.
2011-09-15 13:18:32 +02:00
Marijn Haverbeke
1cda74deee Add representation for by-ref let bindings
Issue #918
2011-09-15 11:42:56 +02:00
Marijn Haverbeke
197f360e30 Ensure parens are wrapped around composite exprs in call/index/field pos
This is needed to fix the second example in issue #919
2011-09-15 11:15:14 +02:00
Marijn Haverbeke
8c83ea564b More thorough check for (.. 10).x in pretty-printer
Closes #919
2011-09-15 10:59:06 +02:00
Marijn Haverbeke
d0d322ac93 Stop mentioning tail calls in reference
They don't work, and won't work in the near future.
2011-09-15 10:14:52 +02:00
Marijn Haverbeke
63ecc84562 Also handle fail and put in print_maybe_parens_discrim
Closes #920
2011-09-15 10:14:52 +02:00
Marijn Haverbeke
3798b6f780 Remove maybe_protect_block kludge from pretty-printer
It is no longer needed.
2011-09-15 10:14:52 +02:00
Marijn Haverbeke
0b34e0e60b Introduce new semicolon rules
- Loop bodies and resource constructors aren't allowed to have
  trailing expressions anymore.

- An expression that ends* in a block without trailing expression can
  can not be called, indexed, or subscripted.

- Only expression-statements that end* in a block without trailing
  expression can omit their semicolon.

*) 'Ending in a trailing expression' is defined as being a block or
   construct-ending-in-a-block (if, alt) that either ends in an
   expression itself, or ends in another block-like expression that
   has a trailing expression (by these same rules).
2011-09-15 09:49:00 +02:00
Marijn Haverbeke
7298b8f4ba Insert omitted semicolons for statements 2011-09-15 09:49:00 +02:00
Brian Anderson
2bed548d1b xfail-fast run-pass/linked-failure.rs. Not sure what the problem is. 2011-09-14 17:47:48 -07:00