about summary refs log tree commit diff
path: root/src/comp/middle/check_alt.rs
AgeCommit message (Collapse)AuthorLines
2012-03-02Move src/comp to src/rustcGraydon Hoare-325/+0
2012-03-02core: Remove _mut functions from vecBrian Anderson-2/+2
Instead, use vec::to_mut/from_mut to transform vectors in place as needed.
2012-02-22Stop normalizing patternsMarijn Haverbeke-18/+27
The check for whether a pat_ident is a variant or a binding is simple and fast. Normalizing patterns again and again is slow and error-prone (several places were forgetting to do it).
2012-02-15Rewrite exhaustiveness checkerMarijn Haverbeke-71/+118
Issue #352 Closes #1720 The old checker would happily accept things like 'alt x { @some(a) { a } }'. It now properly descends into patterns, checks exhaustiveness of booleans, and complains when number/string patterns aren't exhaustive.
2012-02-15Support 'alt check' syntaxMarijn Haverbeke-13/+10
It is only a way to flag an alt as intentionally non-exhaustive right now. Issue #1679
2012-02-11core: Change the argument order for vec::contains, vec::countBrian Anderson-1/+1
2012-02-11core: Rename vec::member to vec::contains to match str modBrian Anderson-1/+1
2012-02-09Remove some pointless importsMarijn Haverbeke-1/+0
2012-02-06Make ty::t type self-sufficientMarijn Haverbeke-1/+1
It is now no longer needed to have a ty::ctxt to get at the contents of a ty::t. The straight-forward approach of doing this, simply making ty::t a box type, unfortunately killed our compiler performance (~15% slower) through refcounting cost. Thus, this patch now represents ty::t as an unsafe pointer, assuming that the ty::ctxt, which holds these boxes alive, outlives any uses of the ty::t values. In the current compiler this trivially holds, but it is does of course add a new potential pitfall. ty::get takes a ty::t and returns a boxed representation of the type. I've changed calls to ty::struct(X) to do ty::get(X).struct. Type structs are full of vectors, and copying them every time we wanted to access them was a bit of a cost.
2012-01-31Require alts to be exhaustiveTim Chevalier-7/+108
middle::check_alt does the work. Lots of changes to add default cases into alts that were previously inexhaustive.
2012-01-25Rename tag to enum throughout the compilerMarijn Haverbeke-4/+4
This should reduce confusion of people trying to read the code.
2012-01-18Remove '.' after nullary tags in patternsTim Chevalier-2/+2
Does what it says on the tin. The next commit will remove support for this syntax.
2012-01-17Allow omission of the '.' after nullary tag patternsTim Chevalier-6/+12
This commit allows patterns like: alt x { some(_) { ... } none { } } without the '.' after none. The parser suspends judgment about whether a bare ident is a tag or a new bound variable; instead, the resolver disambiguates. This means that any code after resolution that pattern-matches on patterns needs to call pat_util::normalize_pat, which consults an environment to do this disambiguation. In addition, local variables are no longer allowed to shadow tag names, so this required changing some code (e.g. renaming variables named "mut", and renaming ast::sub to subtract). The parser currently accepts patterns with and without the '.'. Once the compiler and libraries are changed, it will no longer accept the '.'.
2012-01-12Make driver::session::session no longer an objectMarijn Haverbeke-0/+1
Rather, it is now a struct where properties like opts are accessed directly, and the error-reporting methods are part of a static impl (with the same name as the type).
2011-12-15rustc: Box the vectors returned from ty::tag_variantsBrian Anderson-1/+1
2011-12-13Copy first batch of material from libstd to libcore.Graydon Hoare-3/+3
2011-12-08Allow binding of nested patternsMarijn Haverbeke-26/+29
See src/test/run-pass/nested-patterns.rs for some examples. The syntax is boundvar@subpattern Which will match the subpattern as usual, but also bind boundvar to the whole matched value. Closes #838
2011-12-02Allow literal patterns to contain arbitrary literal expressionsMarijn Haverbeke-5/+7
This removes the need for the unary minus hacks, and allows some other neat things like matching on 1 >> 4. Issue #954
2011-11-22Only warn about unreachable range patterns when appropriateMarijn Haverbeke-10/+5
Also simplifies the literal-munging, and moves it into ast_util Closes #1170
2011-11-17remove compile-command from local variable blocksNiko Matsakis-1/+0
2011-10-07Parse and typecheck by-value and by-ref arg specsMarijn Haverbeke-2/+2
Add sprinkle && throughout the compiler to make it typecheck again. Issue #1008
2011-09-28Revert "Revert "Implement pattern ranges for all numeric types.""Brian Anderson-1/+17
This reverts commit a034f87146e60e1db2327c6f6807c47406a1bb0b. Conflicts: src/comp/middle/check_alt.rs src/comp/middle/trans_alt.rs src/comp/syntax/ast.rs src/comp/syntax/ast_util.rs src/comp/syntax/fold.rs src/comp/syntax/print/pprust.rs Conflicts: src/comp/middle/trans_alt.rs
2011-09-23Add let destructuring for unique boxesBrian Anderson-0/+1
Issue #409
2011-09-23Begin to support pattern matching on unique boxesBrian Anderson-0/+6
Issue #409
2011-09-21Revert "Implement pattern ranges for all numeric types."Marijn Haverbeke-17/+1
This reverts commit ce0f054f9d56df4e60291fc2e1b89ce979cf374f.
2011-09-21Implement pattern ranges for all numeric types.Josh Matthews-1/+17
2011-09-12Factor imports mindlessly.Graydon Hoare-2/+1
2011-09-12Reformat for new mode syntax, step 1Marijn Haverbeke-9/+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-2/+2
2011-08-27Convert rustc::driver::session to istrs. Issue #855Brian Anderson-2/+2
2011-08-22Move functions from syntax::ast to syntax::ast_utilBrian Anderson-0/+2
This leaves syntax::ast just defining the AST, which strikes me as somewhat nicer
2011-08-22Implement pattern guardsMarijn Haverbeke-3/+5
The syntax is alt x { mypat where mycond { ... } } The condition may refer to any of the variables bound by the pattern. When a guard fails, pattern-matching continues with the next pattern. Closes #857
2011-08-20ReformatBrian Anderson-14/+7
This changes the indexing syntax from .() to [], the vector syntax from ~[] to [] and the extension syntax from #fmt() to #fmt[]
2011-08-16Port the compiler to the expr foo::<T> syntax.Erick Tryzelaar-1/+1
2011-08-16Port the compiler to the typaram foo<T> syntax.Erick Tryzelaar-2/+2
2011-08-16Rename std::ivec to std::vecBrian Anderson-1/+1
2011-08-15The wonky for...in... whitespace was bothering me. Sorry!Lindsey Kuper-6/+6
2011-08-15Use span stacks to track macro expansion for less troublesome error messages.Paul Stansifer-1/+1
2011-08-15Make spans into stacks (to store expansion backtraces).Paul Stansifer-1/+1
2011-08-15Add tuple patternsMarijn Haverbeke-0/+12
2011-08-09Port the compiler to the ivec type [T] syntax.Erick Tryzelaar-4/+4
2011-08-01Add check for irrefutable patterns in destructuring localsMarijn Haverbeke-2/+35
2011-07-27Reformat for new syntaxMarijn Haverbeke-35/+35
2011-07-25Add a pass that checks for unreachable alt armsMarijn Haverbeke-0/+102