about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/rand.rs
AgeCommit message (Collapse)AuthorLines
2013-11-26libsyntax: Remove all non-`proc` `do` syntax.Patrick Walton-4/+4
2013-11-19libsyntax: Change all uses of `&fn` to `||`.Patrick Walton-2/+4
2013-11-19Mark some derived methods as #[inline].Huon Wilson-0/+1
ToStr, Encodable and Decodable are not marked as such, since they're already expensive, and lead to large methods, so inlining will bloat the metadata & the binaries. This means that something like #[deriving(Eq)] struct A { x: int } creates an instance like #[doc = "Automatically derived."] impl ::std::cmp::Eq for A { #[inline] fn eq(&self, __arg_0: &A) -> ::bool { match *__arg_0 { A{x: ref __self_1_0} => match *self { A{x: ref __self_0_0} => true && __self_0_0.eq(__self_1_0) } } } #[inline] fn ne(&self, __arg_0: &A) -> ::bool { match *__arg_0 { A{x: ref __self_1_0} => match *self { A{x: ref __self_0_0} => false || __self_0_0.ne(__self_1_0) } } } } (The change being the `#[inline]` attributes.)
2013-11-08Generalize AST and ty::Generics to accept multiple lifetimes.Niko Matsakis-1/+2
2013-11-08syntax::ext: Make type errors in deriving point to the field itself.Huon Wilson-12/+10
This rearranges the deriving code so that #[deriving] a trait on a field that doesn't implement that trait will point to the field in question, e.g. struct NotEq; // doesn't implement Eq #[deriving(Eq)] struct Foo { ok: int, also_ok: ~str, bad: NotEq // error points here. } Unfortunately, this means the error is disconnected from the `deriving` itself but there's no current way to pass that information through to rustc except via the spans, at the moment. Fixes #7724.
2013-09-10Delay assignment of node ids until after expansion. Ensures that each AST nodeNiko Matsakis-3/+3
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-03Modernized a few more types in syntax::astMarvin Löbel-6/+6
2013-09-02Renamed syntax::ast::ident -> IdentMarvin Löbel-3/+3
2013-09-01Modernized a few type names in rustc and syntaxMarvin Löbel-4/+4
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-10std: Rename Iterator.transform -> .mapErick Tryzelaar-1/+1
cc #5898
2013-07-20syntax: modernise attribute handling in syntax::attr.Huon Wilson-2/+2
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-2/+6
2013-06-30Remove vec::{map, mapi, zip_map} and the methods, except for .map, since thisHuon Wilson-2/+2
is very common, and the replacement (.iter().transform().collect()) is very ugly.
2013-06-29'Borrow' stack closures rather than copying them (e.g., "|x|f(x)"), in prep ↵Ben Blum-1/+1
for making them noncopyable.
2013-06-25great renaming propagation: syntaxCorey Richardson-3/+1
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-07syntax: move expand_generic_deriving to be a method on TraitDefHuon Wilson-2/+1
2013-05-30Remove copy bindings from patterns.Niko Matsakis-1/+1
2013-05-29librustc: Stop reexporting the standard modules from prelude.Patrick Walton-0/+2
2013-05-22syntax: Change syntax extensions to expand to `std::foo` instead of `core::foo`Patrick Walton-3/+3
2013-05-22libextra: Rename the actual metadata names of libcore to libstd and libstd ↵Patrick Walton-0/+2
to libextra
2013-05-22syntax/ext: convert all AstBuilder methods to a uniform syntax.Huon Wilson-31/+24
2013-05-22syntax/ext: migrate build.rs functions to AstBuilder methods.Huon Wilson-20/+20
2013-05-22syntax/ext: modernise ext_ctxt to be CamelCase and use new.Huon Wilson-4/+4
2013-05-21syntax/ext: remove the ~str dependence of the deriving code.Huon Wilson-5/+5
2013-05-14rustc: rename ast::self_ty and related fields to explicit_selfErick Tryzelaar-1/+1
2013-05-09Use a specialized string interner to reduce the need for owned stringsBjörn Steinbrink-6/+6
&str can be turned into @~str on demand, using to_owned(), so for strings, we can create a specialized interner that accepts &str for intern() and find() but stores and returns @~str.
2013-05-08libcore: Fix more merge fallout.Patrick Walton-5/+10
2013-05-07libsyntax: add #[deriving(Rand, ToStr)].Huon Wilson-0/+136
The former fills each field of a struct or enum variant with a random value (and picks a random enum variant). The latter makes the .to_str method have the same output as fmt!("%?", ..).