aboutsummaryrefslogtreecommitdiff
path: root/src/comp/util
Commit message (Collapse)AuthorAgeFilesLines
* rustc: Write nil types into the node type table wherever plain_ann() is usedHEADmasterPatrick Walton2011-05-131-5/+0
|
* Downcase std modules again, move to :: for module dereferencingMarijn Haverbeke2011-05-122-114/+114
| | | | This should be a snapshot transition.
* Ensure ann tags are actually kept around during typecheckingMarijn Haverbeke2011-05-121-3/+3
| | | | | | This way, the tag assigned by the parser stays with the node. I realize ann replacing is probably going away real soon, but I needed this now for moving the resolve defs out of the AST.
* rustc: Number everything with an annotationPatrick Walton2011-05-101-1/+1
|
* Alias-ify fold and its users, remove another 85kb.Graydon Hoare2011-05-091-3/+3
|
* Rename std modules to be camelcasedMarijn Haverbeke2011-05-062-55/+55
| | | | (Have fun mergining your stuff with this.)
* Consolidating expr_to_str functions.Lindsey Kuper2011-05-051-4/+4
|
* Un-revert "Use different syntax for checks that matter to typestate", fixing ↵Patrick Walton2011-05-021-2/+2
| | | | | | the problem. This reverts commit d08b443fffb1181d8d45ae5d061412f202dd4118.
* Revert "Use different syntax for checks that matter to typestate"Graydon Hoare2011-05-021-2/+2
| | | | This reverts commit aa25f22f197682de3b18fc4c8ba068d1feda220f. It broke stage2, not sure why yet.
* Use different syntax for checks that matter to typestateTim Chevalier2011-05-021-2/+2
| | | | | | | | | | This giant commit changes the syntax of Rust to use "assert" for "check" expressions that didn't mean anything to the typestate system, and continue using "check" for checks that are used as part of typestate checking. Most of the changes are just replacing "check" with "assert" in test cases and rustc.
* Fixed bug in typeck that wasn't filling in anns for stmtsTim Chevalier2011-04-281-0/+20
| | | | | | | (needed for typestate_check). Also changed a (log; fail) to (log_err; fail) in typestate_check, and added some more logging funs in util.common.
* Support all expression forms in typestateTim Chevalier2011-04-281-0/+32
| | | | | | | | | | | | Added support for self_method, cont, chan, port, recv, send, be, do_while, spawn, and ext; handled break and cont correctly. (However, there are no non-xfailed test cases for ext or spawn in stage0 currently.) Although the standard library compiles and all test cases pass with typestate enabled, I left typestate checking disabled as rustc terminates abnormally when building the standard library if so, even though it does generate code correctly.
* Further work on typestate_checkTim Chevalier2011-04-282-12/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lots of work on typestate_check, seems to get a lot of the way through checking the standard library. * Added for, for_each, assign_op, bind, cast, put, check, break, and cont. (I'm not sure break and cont are actually handled correctly.) * Fixed side-effect bug in seq_preconds so that unioning the preconditions of a sequence of statements or expressions is handled correctly. * Pass poststate correctly through a stmt_decl. * Handle expr_ret and expr_fail properly (after execution of a ret or fail, everything is true -- this is needed to handle ifs and alts where one branch is a ret or fail) * Fixed bug in set_prestate_ann where a thing that needed to be mutated wasn't getting passed as an alias * Fixed bug in how expr_alt was treated (zero is not the identity for intersect, who knew, right?) * Update logging to reflect log_err vs. log * Fixed find_locals so as to return all local decls and exclude function arguments. * Make union_postconds work on an empty vector (needed to handle empty blocks correctly) * Added _vec.cat_options, which takes a list of option[T] to a list of T, ignoring any Nones * Added two test cases.
* rustc: Pass a "type context" around instead of directly passing the type ↵Patrick Walton2011-04-251-2/+2
| | | | store; prep for removing type annotations
* rustc: Switch @ty.t to ty.t so that we can change it to a uintPatrick Walton2011-04-221-1/+1
|
* rustc: Pass a type store around, which does nothing yetPatrick Walton2011-04-211-2/+2
|
* rustc: Remove all uses of plain_ty() and friends from outside of ty.rsPatrick Walton2011-04-201-1/+1
|
* Handle nested items correctly in typestate_checkTim Chevalier2011-04-192-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | Summary says it all. Actually, only nested objects and functions are handled, but that's better than before. The fold that I was using before to traverse a crate wasn't working correctly, because annotations have to reflect the number of local variables of the nearest enclosing function (in turn, because annotations are represented as bit vectors). The fold was traversing the AST in the wrong order, first filling in the annotations correctly, but then re-traversing them with the bit vector length for any outer nested functions, and so on. Remedying this required writing a lot of tedious boilerplate code because I scrapped the idea of using a fold altogether. I also made typestate_check handle unary, field, alt, and fail. Also, some miscellaneous changes: * added annotations to blocks in typeck * fix pprust so it can handle spawn * added more logging functions in util.common * fixed _vec.or * added maybe and from_maybe in option * removed fold_block field from ast_fold, since it was never used
* Remove effect system from src.Graydon Hoare2011-04-191-10/+10
|
* Make expr_while work in typestate_checkTim Chevalier2011-04-131-2/+2
| | | | | | Also did some refactoring in typestate_check. All test cases in compile-fail that involve uninitialized vars now fail correctly! (All eight of them, that is.)
* typestate_check can now handle expr_block, expr_if, and expr_binaryTim Chevalier2011-04-121-0/+4
| | | | | | | | | | | | | | | | (caveat for the latter: it assumes that binary operations are strict; a TODO is to detect or and and and correctly reflect that they're lazy in the second argument). I had to add an ann field to ast.block, resulting in the usual boilerplate changes. Test cases that currently work (if you uncomment the typestate pass in the driver) (all these are under test/compile-fail): fru-typestate ret-uninit use-uninit use-uninit-2 use-uninit-3
* Further work on typestate. Handles expr_rec and expr_assign now.Tim Chevalier2011-04-122-12/+73
| | | | | | | | | | | | Also changed the ts_ann field on statements to be an ann instead, which explains most of the changes. As well, got rid of the "warning: no type for expression" error by filling in annotations for local decls in typeck (not sure whether this was my fault or not). Finally, in bitv, added a clone() function to copy a bit vector, and fixed is_true, is_false, and to_str to not be nonsense.
* rustc: Add a uint hash functionPatrick Walton2011-04-111-0/+8
|
* Move to single-uint file-position representation.Marijn Haverbeke2011-04-091-2/+1
| | | | | | | | This makes passing them around cheaper. There is now a table (see front/codemap.rs) that is needed to transform such an uint into an actual filename/line/col location. Also cleans up the span building in the parser a bit.
* Implemented computing prestates and poststates for a few expression forms.Tim Chevalier2011-04-082-1/+25
| | | | | The typestate checker (if it's uncommented) now correctly rejects a trivial example program that has an uninitialized variable.
* Continued sketching out code for checking states against preconditions.Tim Chevalier2011-04-061-4/+47
| | | | | | | | | It's still sketchy. I added a typestate annotation field to statements tagged stmt_decl or stmt_expr, because a stmt_decl statement has a typestate that's different from that of its child node. This necessitated trivial changes to a bunch of other files all over to the compiler. I also added a few small standard library functions, some of which I didn't actually end up using but which I thought might be useful anyway.
* More work on typestate. Sketched out code for computing and checking ↵Tim Chevalier2011-04-061-5/+24
| | | | prestates and poststates. Still a long ways away.
* Started adding support for typestate checking.Tim Chevalier2011-04-011-0/+61
| | | | | | | | | | | | | | | I added a new field to the ast "ann" type for typestate information. Currently, the field contains a record of a precondition bit vector and postcondition vector, but I tried to structure things so as to make it easy to change the representation of the typestate annotation type. I also had to add annotations to some syntactic forms that didn't have them before (fail, ret, be...), with all the boilerplate changes that that would imply. The main call to the typestate_check entry point is commented out and the actual pre-postcondition algorithm only has a few cases implemented, though the overall AST traversal is there. The rest of the typestate algorithm isn't implemented yet.
* rustc: Mix the bits more when hashing def idsPatrick Walton2011-03-311-9/+8
|
* Another go at changing compile-command, this time using RBUILD env var.Graydon Hoare2011-03-251-1/+1
|
* Revert "Bulk-edit compile commands in emacs chatter to point to assumed ↵Graydon Hoare2011-03-251-1/+1
| | | | | | build/ dir off src root." This reverts commit 846f2e2ba994268725f38c36fa12f1a09f21615c.
* Bulk-edit compile commands in emacs chatter to point to assumed build/ dir ↵Graydon Hoare2011-03-251-1/+1
| | | | off src root.
* rustc: Create a crate metadata cachePatrick Walton2011-03-251-0/+8
|
* Switch all vases of vec += elt to vec += vec. Prohibit former in rustboot. ↵Graydon Hoare2011-03-161-9/+0
| | | | Tweak std lib vec fns in process.
* rustc: Expose common.def_eq().Patrick Walton2011-03-081-5/+5
|
* Add a type for crate directives, to support intermixing with exprs in crate ↵Graydon Hoare2011-02-231-1/+3
| | | | files.
* Make append take a mutable &. Not even checked at present, tsk tsk.Graydon Hoare2010-10-221-1/+1
|
* line length police; moved comp.util.bits to std.bitvDave Herman2010-10-211-463/+0
|
* tests and bugfixes: fns take aliases, fixed binary arithmetic in create, ↵Dave Herman2010-10-211-29/+318
| | | | eliminated wasted bit per uint
* simpler computation of uint_bits(), plus whitespace policeDave Herman2010-10-201-13/+2
|
* created a first draft of the bit-set library needed for typestateDave Herman2010-10-201-0/+185
|
* Teach trans to allocate, initialize and load from local variables.Graydon Hoare2010-10-191-0/+19
|
* Store items and decls in vecs to preserve input order, index externally. ↵Graydon Hoare2010-10-181-0/+9
| | | | Implement block-local name lookup.
* Encode and decode tag types in dwarf properly. Add list module to std. Shift ↵Graydon Hoare2010-10-151-8/+0
| | | | rustc to use std.util.option. Fix various dependent bugs. Closes #73.
* Add input coordinate tracking to all major rustc ast nodes.Graydon Hoare2010-10-051-0/+1
|
* Teach rustc about phi nodes, block relationships. Translate if- and ↵Graydon Hoare2010-10-041-0/+8
| | | | block-expressions.
* Declare the global and upcall glues as ValueRefs in rustc's trans.Graydon Hoare2010-09-231-0/+5
|
* Begin teaching rustc to parse literals, atoms, stmts, blocks, items, ↵Graydon Hoare2010-09-211-0/+6
| | | | modules, crates.
* Bind pattern slots with ?, drop parens from 0-ary tag constructors, ↵Graydon Hoare2010-09-201-24/+24
| | | | translate 0-ary constructors as constants. Rustc loses ~300kb.
* Switch tags to purely nominal, removing TY_iso and TY_idx. Seems to mostly ↵Graydon Hoare2010-09-091-3/+14
| | | | work, possibly a little bumpy. Changes a lot.