summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/decodable.rs
AgeCommit message (Collapse)AuthorLines
2013-12-28Stop using @ExtCtxtSteven Fackler-3/+3
2013-12-07syntax::deriving: add the cx and span to the TraitDef to reduce duplication.Huon Wilson-1/+3
2013-11-26libsyntax: Remove all non-`proc` `do` syntax.Patrick Walton-10/+16
2013-11-19libsyntax: Change all uses of `&fn` to `||`.Patrick Walton-2/+5
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-08syntax::ext: Make type errors in deriving point to the field itself.Huon Wilson-46/+35
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-30syntax: Remove usage of fmt!Alex Crichton-1/+1
2013-09-03Modernized a few more types in syntax::astMarvin Löbel-3/+3
2013-09-01Modernized a few type names in rustc and syntaxMarvin Löbel-3/+3
2013-08-10std: Rename Iterator.transform -> .mapErick Tryzelaar-2/+2
cc #5898
2013-08-03remove obsolete `foreach` keywordDaniel Micay-3/+3
this has been replaced by `for`
2013-08-02replace `range` with an external iteratorDaniel Micay-3/+2
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-1/+1
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-06-30Remove vec::{map, mapi, zip_map} and the methods, except for .map, since thisHuon Wilson-4/+4
is very common, and the replacement (.iter().transform().collect()) is very ugly.
2013-06-25great renaming propagation: syntaxCorey Richardson-3/+2
2013-06-21vec: rm old_iter implementations, except BaseIterDaniel Micay-1/+1
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-13Use @str instead of @~str in libsyntax and librustc. Fixes #5048.Huon Wilson-2/+2
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-07syntax: move expand_generic_deriving to be a method on TraitDefHuon Wilson-2/+1
2013-05-30Rewrite deriving(Decodable, Encodable)Alex Crichton-393/+133
Now it uses the generic deriving code and should in theory work in all cases.
2013-05-29librustc: Stop reexporting the standard modules from prelude.Patrick Walton-3/+5
2013-05-22librustc: Change `std` to `extra` throughout libsyntax and librustcPatrick 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-131/+73
2013-05-22syntax/ext: migrate build.rs functions to AstBuilder methods.Huon Wilson-94/+74
2013-05-22syntax/ext: modernise ext_ctxt to be CamelCase and use new.Huon Wilson-13/+13
2013-05-20Remove all unnecessary allocations (as flagged by lint)Alex Crichton-1/+1
2013-05-16syntax: deprecate #[auto_{en,de}code] in favour of #[deriving({En,De}codable)].Huon Wilson-0/+5
Replace all instances of #[auto_*code] with the appropriate #[deriving] attribute and remove the majority of the actual code, leaving stubs to refer the user to the new syntax.
2013-05-14rustc: rename ast::self_ty and related fields to explicit_selfErick Tryzelaar-2/+2
2013-05-09Use a specialized string interner to reduce the need for owned stringsBjörn Steinbrink-35/+35
&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-08librustc: Remove mutable fields from the language.Patrick Walton-1/+1
They're still parsed though, to get through bootstrapping.
2013-05-07libsyntax: extend generic deriving code to handle almost all possible traits.Huon Wilson-1/+3
This adds support for static methods, and arguments of most types, traits with type parameters, methods with type parameters (and lifetimes for both), as well as making the code more robust to support deriving on types with lifetimes (i.e. 'self).
2013-05-02librustc: Update the serializer to work properly with INHTWAMA, removing ↵Patrick Walton-5/+44
mutable fields in the process
2013-04-27only use #[no_core] in libcoreDaniel Micay-4/+0
2013-04-12libsyntax: abstract most of the deriving boilerplate into a simpler(r) ↵Huon Wilson-1/+2
interface. Pulls out many of the common patterns from the Eq and Clone deriving code (and invents a few of its own), so that deriving instances are very easy to write for a certain class of traits. (Basically, those which don't have parameters and where all methods only take arguments of type `&Self` and return either `Self` or types with no parameters.)
2013-04-10syntax: add support for #[deriving(Decodable)]Erick Tryzelaar-0/+454