about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving
AgeCommit message (Collapse)AuthorLines
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
2013-06-14syntax: correct the Rand::rand call to select enum variants in ↵Huon Wilson-4/+5
#[deriving(Rand)]. Previously, this was not a global call, and so when `#[deriving(Rand)]` was in any module other than the top-level one, it failed (unless there was a `use std;` in scope). Also, fix a minor inconsistency between uints and u32s for this piece of code.
2013-06-13Use @str instead of @~str in libsyntax and librustc. Fixes #5048.Huon Wilson-16/+16
This almost removes the StringRef wrapper, since all strings are Equiv-alent now. Removes a lot of `/* bad */ copy *`'s, and converts several things to be &'static str (the lint table and the intrinsics table). There are many instances of .to_managed(), unfortunately.
2013-06-09std: remove foldr and alli methods in vecHuon Wilson-5/+6
2013-06-09std: remove fold[lr] in favour of iteratorsHuon Wilson-2/+2
2013-06-08std: remove vec::each2 and vec::each2_mut in favour of iteratorsHuon Wilson-2/+3
2013-06-07syntax: correct the modifications to deriving(Ord) so that it works.Huon Wilson-30/+13
2013-06-07syntax: rewrite deriving(Ord) to not require Eq.Huon Wilson-57/+59
lt and gt are implement directly in terms of the corresponding method on their elements, and le and ge are the negations of these.
2013-06-07syntax: move expand_generic_deriving to be a method on TraitDefHuon Wilson-55/+37