about summary refs log tree commit diff
path: root/src/comp/middle/tstate/ck.rs
AgeCommit message (Collapse)AuthorLines
2011-12-13Copy first batch of material from libstd to libcore.Graydon Hoare-1/+1
2011-11-17remove compile-command from local variable blocksNiko Matsakis-1/+0
2011-11-10Cleanup unused importsHaitao Li-8/+5
2011-10-21Drop support for iter, put, and for-eachMarijn Haverbeke-4/+3
Closes #1056
2011-10-20Make fn denote a bare function. Convert fn to fn@ as neededBrian Anderson-1/+2
2011-09-14Rename ast::controlflow to ast::ret_styleMarijn Haverbeke-2/+2
It will include information about returning by alias.
2011-09-12Factor imports mindlessly.Graydon Hoare-35/+9
2011-09-12Reformat for new mode syntax, step 1Marijn Haverbeke-10/+9
Long lines were fixed in a very crude way, as I'll be following up with another reformat in a bit.
2011-09-02Reformat. Issue #855Brian Anderson-27/+20
2011-09-01Rename std::istr to std::str. Issue #855Brian Anderson-1/+1
2011-08-31Check all paths return properly in blocks. Closes #874.Michael Sullivan-1/+1
2011-08-27Convert rustc::driver::session to istrs. Issue #855Brian Anderson-12/+12
2011-08-27Convert pretty-printer to istrs. Issue #855Brian Anderson-5/+6
2011-08-27Convert the rest of rustc::middle to istrs. Issue #855Brian Anderson-14/+14
2011-08-27Convert ast::ident to istr. Issue #855Brian Anderson-5/+12
2011-08-22Move functions from syntax::ast to syntax::ast_utilBrian Anderson-1/+1
This leaves syntax::ast just defining the AST, which strikes me as somewhat nicer
2011-08-20ReformatBrian Anderson-8/+9
This changes the indexing syntax from .() to [], the vector syntax from ~[] to [] and the extension syntax from #fmt() to #fmt[]
2011-08-18Don't warn about unused vars whose name starts with _Marijn Haverbeke-2/+3
Closes #832
2011-08-16Port the compiler to the expr foo::<T> syntax.Erick Tryzelaar-2/+2
2011-08-16Port the compiler to the typaram foo<T> syntax.Erick Tryzelaar-3/+3
2011-08-15The wonky for...in... whitespace was bothering me. Sorry!Lindsey Kuper-1/+1
2011-08-15Fix bad argument type of pprust::print_typeMarijn Haverbeke-1/+1
AST types are boxed, there's no need for every caller to do the unboxing
2011-08-09Port the compiler to the ivec type [T] syntax.Erick Tryzelaar-3/+3
2011-08-01Handle bang functions correctly in typestateTim Chevalier-11/+10
The logic for how the "returns" constraint was handled was always dodgy, for reasons explained in the comments I added to auxiliary::fn_info in this commit. Fixed it by adding distinct "returns" and "diverges" constraints for each function, which are both handled positively (that is: for a ! function, the "diverges" constraint must be true on every exit path; for any other function, the "returns" constraint must be true on every exit path). Closes #779
2011-07-27Reformat for new syntaxMarijn Haverbeke-55/+57
2011-07-19Beginnings of support for constrained typesTim Chevalier-5/+4
Programs with constrained types now parse and typecheck, but typestate doesn't check them specially, so the one relevant test case so far is XFAILed. Also rewrote all of the constraint-related data structures in the process (again), for some reason. I got rid of a superfluous data structure in the context that was mapping front-end constraints to resolved constraints, instead handling constraints in the same way in which everything else gets resolved.
2011-07-13Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases.Graydon Hoare-1/+1
2011-07-12Add missing filesTim Chevalier-34/+24
git add didn't, so this actually has the changes that should have been in the previous commit
2011-07-07rustc: Change lots of AST nodes to use interior vectorsPatrick Walton-3/+3
2011-07-06rustc: Remove unused or seldom-used imports from ↵Patrick Walton-6/+0
middle::tstate::{bitvectors, ck}
2011-07-06rustc: Revert the conversion to interior vectors due to heap corruptionPatrick Walton-0/+6
2011-07-06rustc: Remove unused or seldom-used imports from ↵Patrick Walton-6/+0
middle::tstate::{bitvectors, ck}
2011-07-05Move everything syntax-related to syntax/, break deps on rest of compilerMarijn Haverbeke-22/+23
src/comp/syntax is currently just a sub-module of rustc, but it will, in the near future, be its own crate. This includes: - The AST data structure - The parser - The pretty-printer - Visit, walk, and fold - The syntax extension system - Some utility stuff that should be in the stdlib* *) Stdlib extensions currently require a snapshot before they can be used, and the win build is very broken right now. This is temporary and will be cleaned up when one of those problems goes away. A lot of code was moved by this patch, mostly towards a more organized layout. Some package paths did get longer, and I guess the new layout will take some getting used to. Sorry about that! Please try not to re-introduce any dependencies in syntax/ on any of the other src/comp/ subdirs.
2011-06-30Kill unused variablesTim Chevalier-1/+2
2011-06-30Warn for unused variablesTim Chevalier-22/+33
Modify typestate to check for unused variables and emit warnings where relevant. This exposed a (previously harmless) bug in collect_locals where outer functions had bit-vector entries for init constraints for variables declared in their inner nested functions. Fixing that required changing collect_locals to use visit instead of walk -- probably a good thing anyway.
2011-06-27Tests for while loops that may invalidate constraintsTim Chevalier-4/+4
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-25Use single-bar or to make tstate/states.rs prettierMarijn Haverbeke-3/+3
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-24Modify the fn vistors in walk so that they can handle functions without ↵Michael Sullivan-4/+6
names. Update the typestate code to understand this.
2011-06-22Compute typestate properly for moveTim Chevalier-6/+6
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-20Get rid of def_ids and anns in AST nodes, use single node_idMarijn Haverbeke-13/+12
This reduces some redundancy in the AST data structures and cruft in the code that works with them. To get a def_id from a node_id, apply ast::local_def, which adds the local crate_num to the given node_id. Most code only deals with crate-local node_ids, and won't have to create def_ids at all.
2011-06-19rustc: Rename session.span_err -> span_fatal, err -> fatalBrian Anderson-4/+4
Issue #440
2011-06-19Revert previous 6 commits. Hopefully put out Windows fire.Brian Anderson-4/+4
Revert "rustc: Export only what's needed from middle::ty" This reverts commit 4255d58aa5db2a05362c4435a0e807205e1b8ed7. Revert "rustc: Make name resolution errors less fatal" This reverts commit b8ab9ea89c16c60237e7660804f4321f59ae0435. Revert "rustc: Make import resolution errors less fatal" This reverts commit 92a8ae94b971206bf0502da3dc5f416fcb24cc36. Revert "rustc: Export only what's used from middle::resolve" This reverts commit 4539a2cf7ad99851a165c98ed2f4e4a475cffd7d. Revert "rustc: Re-introduce session.span_err, session.err" This reverts commit 7fe9a88e31ae07f2fd89f6715efedd7e3edf49e6. Revert "rustc: Rename session.span_err -> span_fatal, err -> fatal" This reverts commit c394a7f49ac29a099994e243017065de2ff97f2a.
2011-06-19rustc: Rename session.span_err -> span_fatal, err -> fatalBrian Anderson-4/+4
Issue #440
2011-06-17Restructure the "checking" pass in typestateTim Chevalier-33/+53
I noticed that typestate was being lazier than it should be, because it was only checking typestate for statements and top-level expression (that is, the expression in a stmt_expr, but not any subexpressions). So I rewrote the checks in tstate/ck.rs to use walk, which exposed a few bugs in typestate that I fixed. Also added some more test cases for if-check.
2011-06-16Reformat a bunch of recent churn.Graydon Hoare-1/+2
2011-06-15Reformat source tree (minus a couple tests that are still grumpy).Graydon Hoare-60/+52
2011-06-15Fix assignments to immutable fields throughout the codeMarijn Haverbeke-5/+5
2011-06-13Refactor some typestate-related data structuresTim Chevalier-2/+3
2011-06-01Redo typestate-related data structures to support predicate constraints. No ↵Tim Chevalier-5/+5
actual support yet, just infrastructure.
2011-05-31Consolidate formatting functions a bit more.Graydon Hoare-3/+3