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
Marijn Haverbeke
2ebd19477b
Sanitize use of ids for obj constructors.
...
Typeck and trans used to, by historical coincidence, use the item_obj
node id, which was used to identify the obj type by the rest of the
system, for the constructor function. This is now identified by the
ctor id stored in the tag throughout.
2011-06-24 21:22:52 +02:00
Marijn Haverbeke
9643aedb04
Remove uses of variable name 'res' from rustc
...
This in preparation of making 'res' a keyword for defining resources.
Please don't introduce too many new ones in the meantime...
2011-06-24 21:22:23 +02:00
Marijn Haverbeke
3d7fdb509a
Remove def_obj
...
Since obj constructors and types have different def_ids now,
their def can simply be a def_fn and a def_ty.
2011-06-24 21:13:25 +02:00
Patrick Walton
b4c0893a39
rustc: If needed, duplicate types' heap parts recursively through structural types
2011-06-24 14:32:50 -04:00
Brian Anderson
3aa8d7ff45
rustc: Pretty-print ternary operator
2011-06-23 23:14:40 -07:00
Brian Anderson
b9fc4dfc54
rustc: Cleanup trans_if, trans_alt
2011-06-23 22:16:16 -07:00
Brian Anderson
05c0216654
rustc: Add ternary operator. Closes #565
...
The implementation is so simple it might be considered cheating: at almost
every step the expr_ternary is just converted to expr_if.
2011-06-23 22:16:11 -07:00
Michael Sullivan
5495ad17d1
Fix type inference inside of anonymous functions.
2011-06-23 21:36:10 -07:00
Rafael Ávila de Espíndola
3c534b2bef
Remove parse_str_lit_or_env_ident.
...
We decided to use metadata for the more complex cases, and a simple
string is enough for rustc right now.
2011-06-23 18:42:55 -04:00
Graydon Hoare
14c31c26c2
Flesh out type pp code.
2011-06-23 18:40:44 -04:00
Patrick Walton
f3798fd213
rustc: Load immediate types when iterating over interior vectors
2011-06-23 17:43:03 -04:00