summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving
AgeCommit message (Collapse)AuthorLines
2013-09-25rustdoc: Change all code-blocks with a scriptAlex Crichton-22/+22
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g' find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g' find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-17extra: minor cleanup of Zero and Default syntax extensionErick Tryzelaar-10/+6
2013-09-12syntax: add #[deriving(Default)] syntax extensionErick Tryzelaar-0/+81
2013-09-10auto merge of #9088 : nikomatsakis/rust/issue-6304-AST-tree-not-DAG, ↵bors-5/+5
r=catamorphism Ensures that each AST node has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two representative tests. Fixes #7971 Fixes #6304 Fixes #8367 Fixes #8754 Fixes #8852 Fixes #2543 Fixes #7654
2013-09-10Delay assignment of node ids until after expansion. Ensures that each AST nodeNiko Matsakis-5/+5
has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two representative tests. Fixes #7971 Fixes #6304 Fixes #8367 Fixes #8754 Fixes #8852 Fixes #2543 Fixes #7654
2013-09-10std::at_vec and vec: Unify build_sized, build_sized_opt into buildblake2-ppc-1/+1
These functions have very few users since they are mostly replaced by iterator-based constructions. Convert a few remaining users in-tree, and reduce the number of functions by basically renaming build_sized_opt to build, and removing the other two. This for both the vec and the at_vec versions.
2013-09-03Modernized a few more types in syntax::astMarvin Löbel-102/+102
2013-09-02Renamed syntax::ast::ident -> IdentMarvin Löbel-43/+43
2013-09-01Modernized a few type names in rustc and syntaxMarvin Löbel-80/+80
2013-08-27librustc: Fix merge fallout.Patrick Walton-1/+0
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-7/+20
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
2013-08-12Forbid pub/priv where it has no effectAlex Crichton-1/+1
Closes #5495
2013-08-10std: Rename Iterator.transform -> .mapErick Tryzelaar-5/+5
cc #5898
2013-08-07auto merge of #8285 : huonw/rust/deriving+++, r=alexcrichtonbors-16/+47
Some general clean-up relating to deriving: - `TotalOrd` was too eager, and evaluated the `.cmp` call for every field, even if it could short-circuit earlier. - the pointer types didn't have impls for `TotalOrd` or `TotalEq`. - the Makefiles didn't reach deep enough into libsyntax for dependencies. (Split out from https://github.com/mozilla/rust/pull/8258.)
2013-08-05Updated std::Option, std::Either and std::ResultMarvin Löbel-1/+1
- Made naming schemes consistent between Option, Result and Either - Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None) - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-04syntax: make #[deriving(TotalOrd)] lazy.Huon Wilson-16/+47
Previously it would call: f(sf1.cmp(&of1), f(sf2.cmp(&of2), ...)) (where s/of1 = 'self/other field 1', and f was std::cmp::lexical_ordering) This meant that every .cmp subcall got evaluated when calling a derived TotalOrd.cmp. This corrects this to use let test = sf1.cmp(&of1); if test == Equal { let test = sf2.cmp(&of2); if test == Equal { // ... } else { test } } else { test } This gives a lexical ordering by short-circuiting on the first comparison that is not Equal.
2013-08-03remove obsolete `foreach` keywordDaniel Micay-20/+20
this has been replaced by `for`
2013-08-03auto merge of #8206 : omasanori/rust/blk-to-block, r=graydonbors-3/+3
Just for consistency.
2013-08-02replace `range` with an external iteratorDaniel Micay-7/+5
2013-08-02Replace 'blk' -> 'block' in AstBuilder.OGINO Masanori-3/+3
I didn't rename variables because they are local and are not parts of the public interfaces. Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-16/+16
2013-07-20syntax: modernise attribute handling in syntax::attr.Huon Wilson-40/+39
This does a number of things, but especially dramatically reduce the number of allocations performed for operations involving attributes/ meta items: - Converts ast::meta_item & ast::attribute and other associated enums to CamelCase. - Converts several standalone functions in syntax::attr into methods, defined on two traits AttrMetaMethods & AttributeMethods. The former is common to both MetaItem and Attribute since the latter is a thin wrapper around the former. - Deletes functions that are unnecessary due to iterators. - Converts other standalone functions to use iterators and the generic AttrMetaMethods rather than allocating a lot of new vectors (e.g. the old code would have to allocate a new vector to use functions that operated on &[meta_item] on &[attribute].) - Moves the core algorithm of the #[cfg] matching to syntax::attr, similar to find_inline_attr and find_linkage_metas. This doesn't have much of an effect on the speed of #[cfg] stripping, despite hugely reducing the number of allocations performed; presumably most of the time is spent in the ast folder rather than doing attribute checks. Also fixes the Eq instance of MetaItem_ to correctly ignore spaces, so that `rustc --cfg 'foo(bar)'` now works.
2013-07-17librustc: Remove all uses of "copy".Patrick Walton-15/+25
2013-07-17librustc: Add a lint mode for unnecessary `copy` and remove a bunch of them.Patrick Walton-1/+1
2013-07-08Correct merge errorsNiko Matsakis-4/+4
2013-07-08syntax: Patch up code that was using irrefutable patterns incorrectlyNiko Matsakis-10/+18
2013-07-07De-share ast::TyJames Miller-5/+5
2013-07-07De-manage OptVec<TyParamBounds>James Miller-8/+5
2013-07-07De-manage LifetimeJames Miller-6/+5
2013-07-07De-managed ast::PathJames Miller-6/+6
2013-06-30Remove vec::{map, mapi, zip_map} and the methods, except for .map, since thisHuon Wilson-11/+12
is very common, and the replacement (.iter().transform().collect()) is very ugly.
2013-06-29Remove mutability from unique boxes in the ASTAlex Crichton-1/+1
2013-06-29'Borrow' stack closures rather than copying them (e.g., "|x|f(x)"), in prep ↵Ben Blum-4/+10
for making them noncopyable.
2013-06-28librustc: Change "Owned" to "Send" everywherePatrick Walton-4/+4
2013-06-27Remove many shared pointersPhilipp Brüschweiler-2/+0
Mostly just low-haning fruit, i.e. function arguments that were @ even though & would work just as well. Reduces librustc.so size by 200k when compiling without -O, by 100k when compiling with -O.
2013-06-26Infer default static/Owned bounds for unbounded heap fns/traits (#7264)Ben Blum-3/+3
2013-06-25auto merge of #7365 : cmr/rust/syntax_cleanup, r=Aatchbors-35/+10
Sets the stage for further cleanup (especially mass-slaughter of `@`)
2013-06-25remove the redundant `each` method from OptVecDaniel Micay-2/+2
2013-06-25great renaming propagation: syntaxCorey Richardson-35/+10
2013-06-23Parse and typecheck (not kindcheck) bounds on trait paths.Ben Blum-3/+5
2013-06-22auto merge of #7274 : thestinger/rust/size_hint, r=huonwbors-4/+4
I ran into a weird lifetime bug blocking updating the `collect` method to use `FromIterator`, but everything here works fine.
2013-06-23vec: remove BaseIter implementationDaniel Micay-4/+4
I removed the `static-method-test.rs` test because it was heavily based on `BaseIter` and there are plenty of other more complex uses of static methods anyway.
2013-06-22Expand the deriving(ToStr) implementationAlex Crichton-11/+64
2013-06-21vec: rm old_iter implementations, except BaseIterDaniel Micay-7/+7
The removed test for issue #2611 is well covered by the `std::iterator` module itself. This adds the `count` method to `IteratorUtil` to replace `EqIter`.
2013-06-18replace #[inline(always)] with #[inline]. r=burningtree.Graydon Hoare-5/+5
2013-06-16auto merge of #7142 : alexcrichton/rust/deriving-zero, r=pcwaltonbors-0/+98
This allows mass-initialization of large structs without having to specify all the fields. I'm a bit hesitant, but I wanted to get this out there. I don't really like using the `Zero` trait, because it doesn't really make sense for a type like `HashMap` to use `Zero` as the 'blank allocation' trait. In theory there'd be a new trait, but then that's adding cruft to the language which may not necessarily need to be there. I do think that this can be useful, but I only implemented `Zero` on the basic types where I thought it made sense, so it may not be all that usable yet. (opinions?)
2013-06-14auto merge of #7121 : huonw/rust/rand-call, r=pnkfelixbors-3/+4
r? @pnkfelix
2013-06-14add IteratorUtil to the preludeDaniel Micay-3/+0
2013-06-14Implement a deriving(Zero) attributeAlex Crichton-0/+98
2013-06-14syntax: revert the uint -> u32 "fix"; make the names/comment match.Huon Wilson-4/+4