summary refs log tree commit diff
path: root/src/libsyntax/print
AgeCommit message (Collapse)AuthorLines
2013-03-02libsyntax: Remove `fn@`, `fn~`, and `fn&` from libsyntax. rs=defunPatrick Walton-3/+3
2013-03-02Merge remote-tracking branch 'remotes/origin/incoming' into incomingErick Tryzelaar-17/+13
2013-03-02auto merge of #5137 : yjh0502/rust/empty_struct, r=nikomatsakisbors-1/+1
The fix is straight-forward, but there are several changes while fixing the issue. 1) disallow `mut` keyword when making a new struct In code base, there are following code, ```rust struct Foo { mut a: int }; let a = Foo { mut a: 1 }; ``` This is because of structural record, which is deprecated corrently (see issue #3089) In structural record, `mut` keyword should be allowd to control mutability. But without structural record, we don't need to allow `mut` keyword while constructing struct. 2) disallow structural records in parser level This is related to 1). With structural records, there is an ambiguity between empty block and empty struct To solve the problem, I change parser to stop parsing structural records. I think this is not a problem, because structural records are not compiled already. Misc. issues There is an ambiguity between empty struct vs. empty match stmt. with following code, ```rust match x{} {} ``` Two interpretation is possible, which is listed blow ```rust match (x{}) {} // matching with newly-constructed empty struct (match x{}) {} // matching with empty enum(or struct) x // and then empty block ``` It seems that there is no such code in rust code base, but there is one test which uses empty match statement: https://github.com/mozilla/rust/blob/incoming/src/test/run-pass/issue-3037.rs All other cases could be distinguished with look-ahead, but this can't be. One possible solution is wrapping with parentheses when matching with an uninhabited type. ```rust enum what { } fn match_with_empty(x: what) -> ~str { match (x) { //use parentheses to remove the ambiguity } } ```
2013-03-02Remove REC, change related tests/docsJihyun Yu-1/+1
2013-03-02Fix some struct-tuple def prettyprint issuesSeth Pink-16/+12
- Removed space between struct name and parentheses - Fixed indentation of the rest of the file (missing end) - Don't print parentheses for structs with no fields - Added test
2013-03-01Merge remote-tracking branch 'remotes/origin/incoming' into incomingErick Tryzelaar-2/+5
2013-02-28Fix implicit leaks of imports throughout librariesAlex Crichton-2/+5
Also touch up use of 'pub' and move some tests around so the tested functions don't have to be 'pub'
2013-02-28Merge remote-tracking branch 'remotes/origin/incoming' into incomingErick Tryzelaar-52/+76
2013-02-27Introduce lifetime declarations into the lists of type parameters.Niko Matsakis-39/+63
Major changes are: - replace ~[ty_param] with Generics structure, which includes both OptVec<TyParam> and OptVec<Lifetime>; - the use of syntax::opt_vec to avoid allocation for empty lists; cc #4846
2013-02-26libsyntax: remove vecs_implicitly_copyable from the printerErick Tryzelaar-25/+26
2013-02-26libsyntax: change token::to_str to take &TokenErick Tryzelaar-2/+2
2013-02-25libsyntax: progress on making syntax::visit vecs_implicitly_copyable-freeErick Tryzelaar-34/+34
2013-02-25libsyntax: Convert ast::attribute_ to store a @meta_itemErick Tryzelaar-1/+1
2013-02-21Get rid of structural records in libsyntax and the last bit in librustc.Luqman Aden-16/+42
2013-02-20librustc: Separate most trait bounds with '+'. rs=plussingPatrick Walton-1/+1
2013-02-19auto merge of #4999 : erickt/rust/incoming, r=brsonbors-22/+40
This patch series is doing a couple things with the ultimate goal of removing `#[allow(vecs_implicitly_copyable)]`, although I'm not quite there yet. The main change is passing around `@~str`s in most places, and using `ref`s in others. As far as I could tell, there are no performance changes with these patches, and all the tests pass on my mac.
2013-02-19convert ast::meta_items to take @~strsErick Tryzelaar-3/+3
2013-02-19convert syntax::attr to use @~strsErick Tryzelaar-4/+4
2013-02-19libsyntax: make enum variants take refsErick Tryzelaar-17/+35
2013-02-19auto merge of #5002 : catamorphism/rust/one-tuples, r=graydonbors-0/+9
r? @graydon - This is for greater uniformity (for example, macros that generate tuples). rustc already supported 1-tuple patterns, but there was no way to construct a 1-tuple term. @graydon , as far as your comment on #4898 - it did turn out to be solvable inside the macro (since @luqmana already fixed it using structs instead), but I still think it's a good idea to allow 1-tuples, for uniformity. I don't think anyone is likely to trip over it, and I'm not too worried that it changes the amount of ambiguity.
2013-02-18rustc: For one-tuples, make parsing and printing the type workTim Chevalier-0/+3
and add a test to reflect-visit-data
2013-02-17libsyntax: Update view_item_use/import to reflect actual usageLuqman Aden-2/+2
2013-02-17syntax: Allow 1-tuple expressionsTim Chevalier-0/+6
This is for greater uniformity (for example, macros that generate tuples). rustc already supported 1-tuple patterns, but there was no way to construct a 1-tuple term.
2013-02-15libsyntax: Get rid of uses of `move` and don't parse it.Luqman Aden-3/+3
2013-02-13Remove die!, raplace invocations with fail! Issue #4524 pt 3Nick Desaulniers-9/+9
2013-02-13libsyntax: Pretty print using the new impl syntax. r=brsonPatrick Walton-2/+4
2013-02-07librustc: Lots of de-muting. rs=demutingPatrick Walton-247/+251
2013-02-07Make ~fn non-copyable, make &fn copyable, split barefn/closure types,Niko Matsakis-54/+56
correct handling of moves for struct-record update. Part of #3678. Fixes #2828, #3904, #4719.
2013-02-04Merge remote-tracking branch 'bstrie/rimov' into incomingBrian Anderson-9/+9
Conflicts: src/libsyntax/parse/parser.rs src/test/bench/graph500-bfs.rs src/test/bench/sudoku.rs src/test/run-pass/borrowck-mut-vec-as-imm-slice.rs src/test/run-pass/empty-mutable-vec.rs src/test/run-pass/foreach-nested.rs src/test/run-pass/swap-2.rs
2013-02-03Converted libcore/uint-template.rs to the new string functions.Marvin Löbel-5/+5
- Moved ToStr implementation of unsigned integers to uint-template.rs. - Marked the `str()` function as deprecated. - Forwarded all conversion functions to `core::num::to_str_common()` and `core::num::from_str_common()`. - Fixed most places in the codebase where `to_str()` is being used. - Added uint-template to_str and from_str overflow tests.
2013-02-01Merge remote-tracking branch 'nickdesaulniers/issue4524' into nocomm1Brian Anderson-7/+0
2013-02-01Remove fail keyword from lexer & parser and clean up remaining calls toNick Desaulniers-7/+0
fail Fix merge conflicts - Issue 4524
2013-01-31test cases, cleanupJohn Clements-6/+7
2013-01-31Replace most invocations of fail keyword with die! macroNick Desaulniers-9/+9
2013-01-31Workaround for #4717: pad contents of ast. rs=breakageNiko Matsakis-1/+1
2013-01-31Finalize moves-based-on-type implementation.Niko Matsakis-33/+14
Changes: - Refactor move mode computation - Removes move mode arguments, unary move, capture clauses (though they still parse for backwards compatibility) - Simplify how moves are handled in trans - Fix a number of illegal copies that cropped up - Workaround for bug involving def-ids in params (see details below) Future work (I'll open bugs for these...): - Improve error messages for moves that are due to bindings - Add support for moving owned content like a.b.c to borrow check, test in trans (but I think it'll "just work") - Proper fix for def-ids in params Def ids in params: Move captures into a map instead of recomputing. This is a workaround for a larger bug having to do with the def-ids associated with ty_params, which are not always properly preserved when inlining. I am not sure of my preferred fix for the larger bug yet. This current fix removes the only code in trans that I know of which relies on ty_param def-ids, but feels fragile.
2013-01-30Fix RIMOV damage to libsyntaxBen Striegel-5/+5
2013-01-30RIMOV, round 10Ben Striegel-1/+1
find ./ -type f -name "*.rs" -exec sed -i "s/~\[mut /~\[/g" {} \;
2013-01-30RIMOV, round 8Ben Striegel-2/+2
find ./ -type f -name "*.rs" -exec sed -i "s/ \([a-zA-Z_]\+\): ~\[mut / mut \1: ~\[/g" {} \;
2013-01-30RIMOV, round 7Ben Striegel-1/+1
find ./ -type f -name "*.rs" -exec sed -i "s/ mut \([a-zA-Z_]\+\): ~\[mut / mut \1: ~\[/g" {} \;
2013-01-30RIMOV, round 3Ben Striegel-3/+3
find ./ -type f -name "*.rs" -exec sed -i "s/let \(.*\)\[mut[ ]\?/let mut \1\[/g" {} \;
2013-01-30librustc: Remove legacy exports from the language. r=brsonPatrick Walton-17/+12
2013-01-29libsyntax: De-export libsyntax. rs=deexportingPatrick Walton-210/+229
2013-01-29libsyntax: De-export a lot of libsyntax. rs=deëxportingPatrick Walton-3/+3
2013-01-28syntax: Don't add an extra space before the last comma...Tim Chevalier-1/+0
...when printing struct update expressions.
2013-01-24replace ConstVector trait with the Container traitDaniel Micay-8/+8
2013-01-24unit test cases now pass, added a few to the internerJohn Clements-27/+50
2013-01-23cleaning up, adding testsJohn Clements-5/+5
2013-01-23libsyntax: Implement the `+` syntax for multiple trait bounds. r=tjcPatrick Walton-0/+7
2013-01-23Merge pull request #4596 from Trinick/tomutrenameTim Chevalier-3/+3
core: Rename to_mut and from_mut to cast_to_mut and cast_from_mut