Commit graph

3561 commits

Author SHA1 Message Date
Josh Matthews
a2775a5b72 Make non-str fail expression a type checking failure instead of a translation one. 2011-07-03 21:46:17 -07:00
Tim Chevalier
b110bbf886 Un-XFAIL fail-arg 2011-07-03 11:56:23 -07:00
Tim Chevalier
046c25dbc0 Handle fail as an argument; parse fail expressions unambiguously
An expression like:

foo(1, fail, 2)

was failing to parse, because the parser was interpreting the comma
as the start of an expression that was an argument to fail, rather
than recognizing that the fail here has no arguments

Fixed this by using can_begin_expr to determine whether the next
token after a fail token suggests that this is a nullary fail or a
unary fail.

In addition, when translating calls, check before translating each
argument that the block still isn't terminated. This has the effect
that if an argument list includes fail, the back-end won't keep trying
to generate code for successive arguments and trip the !*terminated
assertion.
2011-07-03 11:51:47 -07:00
Tim Chevalier
6369807ffe Add a predicate that determines whether a token can begin an expression 2011-07-03 11:51:46 -07:00
Tim Chevalier
48a69d2100 Eliminate all direct calls to option::get() from typeck
This means fewer mysterious error messages.
2011-07-03 02:48:08 -07:00
Tim Chevalier
c425a422ed Manipulate contexts correctly in trans_fail_expr
This fixes Issue #617
2011-07-03 02:38:11 -07:00
Tim Chevalier
9349826909 XFAILing the new test case...
...because the parsing of fail got changed out from under me.
Will fix shortly.
2011-07-03 01:15:41 -07:00
Tim Chevalier
7426252549 Generate code properly for calls with _|_ - typed arguments
The code for translating a fail (for example) would call
Unreachable(), which terminates the block; if a fail appeared as an
argument, this would cause an LLVM assertion failure. Changed
trans_call to handle this situation correctly.
2011-07-02 22:02:59 -07:00
Tim Chevalier
f0fad0dca5 Add a function that determines whether the block is terminated 2011-07-02 22:02:08 -07:00
Brian Anderson
434b199362 Add Rob Arnold to AUTHORS.txt 2011-07-02 00:08:29 -07:00
Josh Matthews
a4421cc4e8 Fix assertion failure when syntax extension name is missing. 2011-07-02 00:06:58 -07:00
Brian Anderson
7c8ee712be Fix the error-pattern on compile-fail/fail-simple
Recent changes to the fail statement changed the way the parser errors in this
scenario.
2011-07-02 00:06:58 -07:00
Josh Matthews
d485e0d15a Allow any string expression to be used with fail. 2011-07-02 00:06:58 -07:00
Patrick Walton
67c9ef9b30 rustc: Fix memory corruption with ivectors-inside-ivectors by duplicating *first*, and *then* copying subtypes. 2011-07-01 20:07:19 -07:00
Patrick Walton
d39c59ae41 rustc: Move path_to_str to front::ast 2011-07-01 17:22:18 -07:00
Rob Arnold
4e59b0be54 Sync rust_chan's deref() method with rustc's code.
If the channel is associated with a port then the destructor will assert.
Additionally, destruction of the object is not always appropriate. This brings
the deref() method into sync with the behavior of generated rust code which
only invokes destroy() once the reference count goes to 0.
2011-07-01 16:59:11 -07:00
Rob Arnold
02a5949aba Add macro for refcounting runtime structures.
The macro with the extra dtor parameter is intended for structures like
rust_chan which may not necessarily delete themselves when the ref count
becomes 0. This functionality will be used in an upcoming changeset.
2011-07-01 16:59:10 -07:00
Rob Arnold
73cc624e8e Move the channel destroy code into rust_chan.
This lets native code more easily destroy channels since directly deleting a
channel is not always the right way to destroy it.
2011-07-01 16:59:10 -07:00
Rob Arnold
09921cf86f Move channel cloning logic into a method on rust_chan.
This will allow us to more easily clone channels from native code.
2011-07-01 16:59:10 -07:00
Brian Anderson
396c4defcc Introduce --cfg argument for providing additional configuration. Issue #489 2011-07-01 15:30:25 -07:00
Brian Anderson
a34b61fb15 Add some FIXMEs for issue #607 2011-07-01 12:51:46 -07:00
Brian Anderson
021b203fc6 Add some logging to attr when reading crate link attributes
Only link attributes of the meta_list type are considered when matching crate
attributes. Instead of doing nothing we can at least log that link attributes
of other types were ignored.
2011-07-01 12:30:27 -07:00
Brian Anderson
22be98264e Add a test for mismatched crate metadata in use statements 2011-07-01 12:26:57 -07:00
Patrick Walton
f7a2f01746 Revert "rustc: Change methods in ty::t to use interior vectors"
This reverts commit 6720ea760d.
2011-07-01 11:37:19 -07:00
Patrick Walton
6720ea760d rustc: Change methods in ty::t to use interior vectors 2011-07-01 11:33:17 -07:00
Brian Anderson
172c5633c4 Export only what's in use from front::eval. Issue #604 2011-07-01 10:46:59 -07:00
Brian Anderson
bdc5abe82c Remove unused imports from front::eval 2011-07-01 10:45:30 -07:00
Brian Anderson
8614cc975c Remove remaining unused eval methods. Issue #604 2011-07-01 10:45:30 -07:00
Brian Anderson
91b87b31e5 Remove the concept of crate directive let statements. Issue #604 2011-07-01 10:45:30 -07:00
Brian Anderson
d8fe0d7cee Remove the concept of crate directive expressions. Issue #604 2011-07-01 10:45:30 -07:00
Brian Anderson
bca45720f7 Remove the environment concept from front::eval
This is the old method of conditional compilation. It is going away.

Issue #489
2011-07-01 10:45:30 -07:00
Brian Anderson
70a28dc238 Cleanup attribute code. Issue #487 2011-07-01 10:45:30 -07:00
Brian Anderson
26ce1e1035 Add some helper functions to front::attr 2011-07-01 10:45:29 -07:00
Brian Anderson
5fb9cad38d Partially restore the fuzzer crate's build rules
Right now the stage1/fuzzer crate will build but it's not linked to librustc
because stage1/librustc won't link.
2011-07-01 10:43:21 -07:00
Marijn Haverbeke
77f5d14f14 Track def_ids of native types so that they can be distinguished
Closes #526
2011-07-01 18:39:24 +02:00
Marijn Haverbeke
d863cdb98f Add tests for newtype-style tags 2011-07-01 17:51:49 +02:00
Marijn Haverbeke
432e5e9f7f Allow dereferencing of single-variant, single-argument tag values
(Using the * operator.)

This makes tags more useful as nominal 'newtype' types, since you no
longer have to copy out their contents (or construct a cumbersome
boilerplate alt) to access them.

I could have gone with a scheme where you could dereference individual
arguments of an n-ary variant with ._0, ._1, etc, but opted not to,
since we plan to move to a system where all variants are unary (or, I
guess, nullary).
2011-07-01 17:51:47 +02:00
Marijn Haverbeke
57e6340253 Allow 'newtype' syntax for tags
Doing this:

    tag foo = mytype;

is now equivalent to doing this:

    tag foo { foo(mytype); }
2011-07-01 17:51:43 +02:00
Marijn Haverbeke
fb72be0a89 Do not store a tag num for single-variant tags
This is a preparation for tags-as-nominal-types. A tag that has only a
single variant is now represented, at run-time, as simply a tuple of
the variant's parameters, with the variant id left off.
2011-07-01 17:50:52 +02:00
Marijn Haverbeke
bf20fe5575 Make sure the pretty-printer understand resources 2011-07-01 13:04:49 +02:00
Michael Sullivan
7b1b5d5a8a Implement autoderef for function calls.
This is important since we are going to be making functions noncopyable
soon, which means we'll be seeing a lot of boxed functions.
(*f)(...) is really just too heavyweight.

Doing the autodereferencing was a very little bit tricky since
trans_call works with an *lval* of the function whereas existing
autoderef code was not for lvals.
2011-07-01 12:39:58 +02:00
Michael Sullivan
ee45d54a4e Move autoderefed_ty to ty.rs and rename it type_autoderef. 2011-07-01 12:39:57 +02:00
Patrick Walton
b4465aca5a stdlib: Fix long line in sort.rs 2011-06-30 22:21:30 -07:00
Patrick Walton
4c76bfdc1f stdlib: Add an interior vector version of sort and a test case 2011-06-30 19:09:52 -07:00
Patrick Walton
b773f8d22b rustc: Duplicate heap data of interior vectors when passing them by value 2011-06-30 19:09:52 -07:00
Graydon Hoare
0eb257e864 Minor pp cleanups. 2011-06-30 17:58:19 -07:00
Graydon Hoare
6d441d3238 Preserve hard \n\n pairs from source when pretty-printing, as explicit formatting control from users. 2011-06-30 17:25:20 -07:00
Patrick Walton
dc9f285b06 rustc: Remove unused variables from last commit 2011-06-30 16:19:04 -07:00
Patrick Walton
108cc4e0ed rustc: Change function argument types to interior vectors 2011-06-30 16:11:39 -07:00
Brian Anderson
50b1953f9b Pretty-print view items in mod items
For mods that aren't defined at the file level we were forgetting to print the
view items so, e.g. 'mod { use std; }' would not print correctly.
2011-06-30 16:08:28 -07:00