about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/to_str.rs
AgeCommit message (Collapse)AuthorLines
2014-02-24Remove deriving(ToStr)Alex Crichton-132/+0
This has been superseded by deriving(Show). cc #9806
2014-02-21syntax: Allow syntax extensions to have attributesErick Tryzelaar-0/+1
2014-02-14auto merge of #12234 : sfackler/rust/restructure-item-decorator, r=huonwbors-3/+3
The old method of building up a list of items and threading it through all of the decorators was unwieldy and not really scalable as non-deriving ItemDecorators become possible. The API is now that the decorator gets an immutable reference to the item it's attached to, and a callback that it can pass new items to. If we want to add syntax extensions that can modify the item they're attached to, we can add that later, but I think it'll have to be separate from ItemDecorator to avoid strange ordering issues. @huonw
2014-02-14Refactored ast_map and friends, mainly to have Paths without storing them.Eduard Burtescu-3/+3
2014-02-13Tweak ItemDecorator APISteven Fackler-3/+3
The old method of building up a list of items and threading it through all of the decorators was unwieldy and not really scalable as non-deriving ItemDecorators become possible. The API is now that the decorator gets an immutable reference to the item it's attached to, and a callback that it can pass new items to. If we want to add syntax extensions that can modify the item they're attached to, we can add that later, but I think it'll have to be separate from ItemDecorator to avoid strange ordering issues.
2014-02-11to_str -- update to contain scope of closureNiko Matsakis-20/+21
2014-02-08Update deriving to pass around the `cx` linearlyNiko Matsakis-4/+3
2014-02-08syntax: convert deriving to take &mut ExtCtxt.Huon Wilson-2/+2
2014-02-02librustc: Fix merge fallout.Patrick Walton-2/+5
2014-02-02libsyntax: De-`@str` literal strings in the ASTPatrick Walton-13/+31
2014-01-09libsyntax: Renamed types, traits and enum variants to CamelCase.Eduard Burtescu-5/+5
2013-12-28Stop using @ExtCtxtSteven Fackler-2/+2
2013-12-07syntax::deriving: add the cx and span to the TraitDef to reduce duplication.Huon Wilson-1/+3
2013-11-28Register new snapshotsAlex Crichton-3/+3
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-4/+4
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-10-21std: Move sys::log_str to repr::repr_to_str. Further work on #2240.Brian Anderson-3/+4
2013-09-03Modernized a few more types in syntax::astMarvin Löbel-4/+4
2013-09-02Renamed syntax::ast::ident -> IdentMarvin Löbel-2/+2
2013-09-01Modernized a few type names in rustc and syntaxMarvin Löbel-3/+3
2013-08-03remove obsolete `foreach` keywordDaniel Micay-1/+1
this has been replaced by `for`
2013-08-02Replace 'blk' -> 'block' in AstBuilder.OGINO Masanori-1/+1
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-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-28librustc: Change "Owned" to "Send" everywherePatrick Walton-1/+1
2013-06-25great renaming propagation: syntaxCorey Richardson-2/+0
2013-06-22Expand the deriving(ToStr) implementationAlex Crichton-11/+64
2013-06-07syntax: move expand_generic_deriving to be a method on TraitDefHuon Wilson-2/+1
2013-05-22syntax: Change syntax extensions to expand to `std::foo` instead of `core::foo`Patrick Walton-2/+2
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-6/+6
2013-05-22syntax/ext: migrate build.rs functions to AstBuilder methods.Huon Wilson-3/+3
2013-05-22syntax/ext: modernise ext_ctxt to be CamelCase and use new.Huon Wilson-3/+3
2013-05-21syntax/ext: remove the ~str dependence of the deriving code.Huon Wilson-3/+3
2013-05-20Remove all unnecessary allocations (as flagged by lint)Alex Crichton-1/+1
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-4/+4
&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-07libsyntax: add #[deriving(Rand, ToStr)].Huon Wilson-0/+54
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!("%?", ..).