about summary refs log tree commit diff
path: root/src/comp
AgeCommit message (Collapse)AuthorLines
2011-06-26Update README filesBrian Anderson-45/+44
2011-06-26Add a very simple map implementation for sequential integer keysBrian Anderson-1/+104
Use it for the ast_map. Cuts 40% off the time spent prior to LLVM.
2011-06-26Reformulate an assert in ty::tag_variantsBrian Anderson-2/+7
This was doing a redundant hashmap lookup. Removing the redundancy trims 5% (2.8s) off rustc's compile time
2011-06-25Fail typechecking for bad binop/type combinationsBrian Anderson-13/+117
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-25Use single-bar or to make tstate/states.rs prettierMarijn Haverbeke-173/+89
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-25Primitive support for non-copyable valuesMarijn Haverbeke-10/+25
2011-06-25Allow moving out of temporary valuesMarijn Haverbeke-15/+16
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-25Partial implementation of resourcesMarijn Haverbeke-17/+198
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-25Remove variable name 'res' from test suiteMarijn Haverbeke-6/+6
2011-06-24Fix inexhaustive match in parserTim Chevalier-0/+7
2011-06-24Invalidate constraints correctly after an assignment expressionTim Chevalier-374/+400
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-24Use visit_fn_{pre,post} to avoid going past lambdas during writeback instead ↵Michael Sullivan-10/+13
of explicitly casing.
2011-06-24Have walk call visit_fn_pre and visit_fn_post on fn expressions.Michael Sullivan-2/+1
As a side effect, this fixes a bug where typestate would not properly be checked inside of fn expressions.
2011-06-24Modify the fn vistors in walk so that they can handle functions without ↵Michael Sullivan-25/+42
names. Update the typestate code to understand this.
2011-06-24rustc: Increment by the unit size in iter_structural_ty when iterating over ↵Patrick Walton-2/+10
interior vectors if the unit size is dynamic
2011-06-24Sanitize use of ids for obj constructors.Marijn Haverbeke-14/+12
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-24Remove uses of variable name 'res' from rustcMarijn Haverbeke-331/+321
This in preparation of making 'res' a keyword for defining resources. Please don't introduce too many new ones in the meantime...
2011-06-24Remove def_objMarijn Haverbeke-28/+7
Since obj constructors and types have different def_ids now, their def can simply be a def_fn and a def_ty.
2011-06-24rustc: If needed, duplicate types' heap parts recursively through structural ↵Patrick Walton-32/+65
types
2011-06-23rustc: Pretty-print ternary operatorBrian Anderson-0/+14
2011-06-23rustc: Cleanup trans_if, trans_altBrian Anderson-36/+6
2011-06-23rustc: Add ternary operator. Closes #565Brian Anderson-2/+64
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-23Fix type inference inside of anonymous functions.Michael Sullivan-2/+11
2011-06-23Remove parse_str_lit_or_env_ident.Rafael Ávila de Espíndola-29/+13
We decided to use metadata for the more complex cases, and a simple string is enough for rustc right now.
2011-06-23Flesh out type pp code.Graydon Hoare-4/+19
2011-06-23rustc: Load immediate types when iterating over interior vectorsPatrick Walton-2/+30
2011-06-23Correct error message for argument mode mismatchTim Chevalier-9/+26
If you use a function expecting an alias argument in a context that expects a function expecting a value argument, or vice versa, the previous error message complained that the number of arguments was wrong. Fixed the error message to be accurate.
2011-06-22Compute typestate properly for moveTim Chevalier-219/+619
typestate now drops constraints correctly in the post-state of a move expression or a declaration whose op is a move. It doesn't yet drop constraints mentioning variables that get updated. To do this, I had to change typestate to use trit-vectors instead of bit-vectors, because for every constraint, there are three possible values: known-to-be-false (e.g. after x <- y, init(y) is known-to-be-false), known-to-be-true, and unknown. Before, we conflated known-to-be-false with unknown. But move requires them to be treated differently. Consider: (program a) (a1) x = 1; (a2) y <- x; (a3) log x; (program b) (b1) x = 1; (b2) y <- z; (b3) log x; With only two values, the postcondition of statement a2 for constraint init(x) is the same as that of b2: 0. But in (a2)'s postcondition, init(x) *must* be false, but in (b2)'s condition, it's just whatever it was in the postcondition of the preceding statement.
2011-06-22rustc: Convert field access on invalid types from an ICE to a fatal errorBrian Anderson-5/+4
Closes #367
2011-06-22Some work on supporting forwarding slots in vtables (issue #539).Lindsey Kuper-42/+70
2011-06-22rustc: Use the rhs span when unifying binopsBrian Anderson-1/+1
This makes the error message correctly identify the term that wasn't the expected type. Issue #516.
2011-06-22rustc: Remove some unneeded type annotationsBrian Anderson-9/+9
2011-06-22rustc: Don't commit unification changes until unify succeedsBrian Anderson-8/+16
This is so that subsequent reports about type mismatches get the types correct. Issue #516
2011-06-22rustc: Limit creader exportsBrian Anderson-0/+7
2011-06-22rustc: Downcase metadata::EncodeBrian Anderson-4/+4
2011-06-22rustc: Handle valueless ret expressions as block results. Closes #521Brian Anderson-0/+2
2011-06-22Fix bug: globbed imports were importing everything visible from the otherPaul Stansifer-6/+19
module, not just everything exported.
2011-06-22rustc: Introduce and parse additional meta_item formsBrian Anderson-37/+136
Examples: #[test], #[link(name = "vers")] Issue #487
2011-06-22Use fast regalloc and codegen at OptLevel=0.Rafael Ávila de Espíndola-4/+31
2011-06-22rustc: Rename parser.err to parser.fatalBrian Anderson-29/+29
2011-06-23Remove a simidgeon of dead code.Paul Stansifer-8/+1
2011-06-22Pull environment loading out into a function.Michael Sullivan-36/+50
2011-06-22Pull building the environment for for_each into a seperate function.Michael Sullivan-47/+61
2011-06-22Removing out-of-date comment.Michael Sullivan-1/+1
2011-06-21Emit a better error message for unbound type parameters in nested functionsTim Chevalier-7/+12
This code was causing a bounds check failure: fn hd[U](&vec[U] v) -> U { fn hd1(&vec[U] w) -> U { ret w.(0); } ret hd1(v); } because in hd1, U was being treated as if it referred to a type parameter of hd1, rather than referring to the lexically enclosing binding for U that's part of hd. I'm actually not sure whether this is a legit program or not. But I wanted to get rid of the bounds check error, so I assumed that program shouldn't compile and made it a proper error message.
2011-06-21Serialize constraints in types (literal arguments still not supported)Tim Chevalier-105/+101
This involved, in part, changing the ast::def type so that a def_fn has a "purity" field. This lets the typechecker determine whether functions defined in other crates are pure. It also required updating some error messages in tests. As a test for cross-crate constrained functions, I added a safe_slice function to std::str (slice(), with one of the asserts replaced with a function precondition) and some test cases (various versions of fn-constraint.rs) that call it. Also, I changed "fn" to "pred" for some of the boolean functions in std::uint.
2011-06-21Move names and ids of native items into their recs, rather than their tagsMarijn Haverbeke-74/+56
2011-06-21Puts out burning tinderbox (oops, AST nodes don't have def_ids/anns).Lindsey Kuper-5/+4
2011-06-21Some progress on support for extending objects with new fields (issueLindsey Kuper-54/+214
into four separate issues (#538, #539, #540, #543) with corresponding tests.
2011-06-21Move expr ids into the expr record typeMarijn Haverbeke-938/+814
This simplifies the tag variants a bit and makes expr_node_id obsolete.