Brian Anderson
cab73f8897
Write metadata for more meta_item types. Issue #487
2011-06-28 10:12:05 -07:00
Brian Anderson
f53c4f79d7
Write metadata for crate attributes. Issue #487
2011-06-28 10:03:41 -07:00
Brian Anderson
894e2229ac
Add emacs variables to encoder.rs
2011-06-28 10:03:40 -07:00
Brian Anderson
d328c7e03e
List crate attributes when running rustc with '--ls'
2011-06-28 10:03:40 -07:00
Marijn Haverbeke
9561def209
Use 'resource' rather than 'res' as a keyword
...
Resources are now defined like...
resource fd(int n) { close(n); }
Calling fd with an int will then produce a non-copyable value
that, when dropped, will call close on the given int.
2011-06-28 18:00:39 +02:00
Marijn Haverbeke
fb14afd5eb
Add test cases for resources
2011-06-28 18:00:38 +02:00
Marijn Haverbeke
07125aa38b
Fix bug that prevented boxes-in-resources from being freed
2011-06-28 18:00:05 +02:00
Marijn Haverbeke
e2cb97a2fc
Add some missing cases for ty_res in ty.rs
2011-06-28 18:00:05 +02:00
Marijn Haverbeke
d730bb730a
Make it possible to use * to dereference a resource
2011-06-28 18:00:05 +02:00
Paul Stansifer
b3443eb049
'#simplext' -> '#macro'
2011-06-28 15:02:12 +00:00
Paul Stansifer
c3901cdf8e
Add simple syntax extension (#simplext)
2011-06-28 15:02:12 +00:00
Paul Stansifer
b632681780
Add AST fold.
2011-06-28 15:02:12 +00:00
Marijn Haverbeke
be748fc215
Properly guard resource values against double-drop
...
Ths involved adding an extra field to their representation, so that there is
something to check for zero.
2011-06-28 16:14:15 +02:00
Rafael Ávila de Espíndola
ecc080ed0b
Use "" in the native_name as an indication that no extra options have to
...
be passed to the "linker". Use that for libc.
2011-06-28 08:21:13 -04:00
Patrick Walton
663aa76635
rustc: Call cmp glue directly if we statically know it
2011-06-27 18:35:01 -07:00
Patrick Walton
dfccd5a138
rustc: Fix stack explosion on -O0 from Alloca() instead of alloca() in cmp glue
2011-06-27 18:27:26 -07:00
Tim Chevalier
85b5b2a8e4
Tests for while loops that may invalidate constraints
...
Wrote some small test cases that use while loops and moves, to
make sure the poststate for the loop body gets propagated into the
new prestate and deinitialization gets reflected.
Along with that, rewrite the code for intersecting states. I still
find it dodgy, but I guess I'll continue trying to add more tests.
Also, I'll probably feel better about it once I start formalizing
the algorithm.
2011-06-27 18:14:23 -07:00
Tim Chevalier
6d1050b1c7
pure_exp should set the state, not extend it
...
This fixes a bug where de-initializations were getting masked
(and programs that used a variable that had been de-initialized
snuck through).
2011-06-27 18:14:23 -07:00
Brian Anderson
a72481f90b
Rename metadata::defs to metadata::tags
2011-06-27 16:43:50 -07:00
Brian Anderson
55944f4e7f
Don't export some of the metadata modules
2011-06-27 16:38:57 -07:00
Brian Anderson
df2cfac07f
Move what's left of metadata::cwriter into middle::trans
2011-06-27 16:30:27 -07:00
Brian Anderson
45efb1f02a
Cleanup in metadata module
2011-06-27 16:30:27 -07:00
Brian Anderson
119193497e
Extract metadata::decoder from metadata::creader
2011-06-27 16:30:27 -07:00
Brian Anderson
a3a2cc3d98
Extract metadata::tydecode from metadata::creader
2011-06-27 16:30:27 -07:00
Brian Anderson
33294c7293
Extract llvm-independent code from cwriter to metadata::encoder
2011-06-27 16:30:27 -07:00
Brian Anderson
279a229414
Move metadata tag definition to metadata::defs
2011-06-27 16:30:27 -07:00
Brian Anderson
6c23e09454
Limit exports from metadata::tyencode
2011-06-27 16:30:27 -07:00
Brian Anderson
5601a6f534
Move metadata::cwriter::encode to metadata::tyencode
2011-06-27 16:30:27 -07:00
Brian Anderson
ba5c7a570d
Rename middle::metadata to metadata::cwriter. Move creader to metadata
...
Preparation for a lot more metadata refactoring
2011-06-27 16:30:27 -07:00
Brian Anderson
d4a5487e1c
Limit exports from middle::metadata
2011-06-27 16:30:27 -07:00
Patrick Walton
e4b5d910dc
rustc: Directly emit calls to glue if possible
2011-06-27 15:38:21 -07:00
Brian Anderson
36fb754476
Index obj and res ctor metadata by ctor id, not item id
...
Both the type and the ctor were trying to use the same id and this was making
creader unable to find the ctor when running 'rustc --ls'
2011-06-27 12:34:44 -07:00
Rafael Ávila de Espíndola
ac081c30be
Record and link with used native libraries.
2011-06-27 15:24:44 -04:00
Tim Chevalier
a6f36ba3f5
removing log statement that snuck in there
2011-06-27 11:38:07 -07:00
Tim Chevalier
1656fa19ef
Implement move for scalar values
...
Before, something like:
let int y = 42;
let int x;
x <- y;
would cause an LLVM assertion failure. Fixed it.
2011-06-27 11:32:06 -07:00
Brian Anderson
fcbdac96dd
Update README files
2011-06-26 22:27:22 -07:00
Brian Anderson
29a8219c4c
Add a very simple map implementation for sequential integer keys
...
Use it for the ast_map. Cuts 40% off the time spent prior to LLVM.
2011-06-26 20:37:08 -07:00
Brian Anderson
08b49a5d8f
Reformulate an assert in ty::tag_variants
...
This was doing a redundant hashmap lookup. Removing the redundancy trims 5%
(2.8s) off rustc's compile time
2011-06-26 18:02:47 -07:00
Brian Anderson
cfaa0f4b91
Fail typechecking for bad binop/type combinations
...
Includes assignment operations. Add regression tests for lots of less useful,
less used or unexpected combinations, as well as a selection of compile-fail
tests. Closes #500 (again!)
2011-06-25 19:42:59 -07:00
Marijn Haverbeke
afa632124f
Use single-bar or to make tstate/states.rs prettier
...
Sorry. This is the kind of thing I do when I'm on a plane and too
tired to manage anything that requires thinking.
2011-06-25 21:16:03 +02:00
Marijn Haverbeke
7432017d5e
Primitive support for non-copyable values
2011-06-25 21:15:11 +02:00
Marijn Haverbeke
f6753be655
Allow moving out of temporary values
...
This will probably need more work, as moving doesn't appear to do
quite the right thing yet in general, and we should also check
somewhere that we're not, for example, moving out the content out of
an immutable field (probably moving out of fields is not okay in
general).
2011-06-25 21:15:11 +02:00
Marijn Haverbeke
61fc12d0d0
Partial implementation of resources
...
Non-copyability is not enforced yet, and something is still flaky with
dropping of the internal value, so don't actually use them yet. I'm
merging this in so that I don't have to keep merging against new
patches.
2011-06-25 21:15:11 +02:00
Marijn Haverbeke
781a265b88
Remove variable name 'res' from test suite
2011-06-25 21:15:04 +02:00
Tim Chevalier
c772269f08
Fix inexhaustive match in parser
2011-06-24 22:38:01 -07:00
Tim Chevalier
582e1f13f0
Invalidate constraints correctly after an assignment expression
...
Modified typestate to throw away any constraints mentioning a
variable on the LHS of an assignment, recv, assign_op, or on
either side of a swap.
Some code cleanup as well.
2011-06-24 22:36:53 -07:00
Michael Sullivan
818d7c9398
Use visit_fn_{pre,post} to avoid going past lambdas during writeback instead of explicitly casing.
2011-06-24 15:55:08 -07:00
Michael Sullivan
b732ec6f82
Have walk call visit_fn_pre and visit_fn_post on fn expressions.
...
As a side effect, this fixes a bug where typestate would not properly be checked
inside of fn expressions.
2011-06-24 15:46:20 -07:00
Michael Sullivan
f3717da1b1
Modify the fn vistors in walk so that they can handle functions without names. Update the typestate code to understand this.
2011-06-24 15:46:20 -07:00
Patrick Walton
baf474443a
rustc: Increment by the unit size in iter_structural_ty when iterating over interior vectors if the unit size is dynamic
2011-06-24 17:36:30 -04:00