about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/cmp
AgeCommit message (Collapse)AuthorLines
2014-03-23std: remove the `equals` method from `TotalEq`.Huon Wilson-7/+16
`TotalEq` is now just an assertion about the `Eq` impl of a type (i.e. `==` is a total equality if a type implements `TotalEq`) so the extra method is just confusing. Also, a new method magically appeared as a hack to allow deriving to assert that the contents of a struct/enum are also TotalEq, because the deriving infrastructure makes it very hard to do anything but create a trait method. (You didn't hear about this horrible work-around from me :(.)
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-7/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-4/+4
Closes #12771
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-0/+8
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-31/+31
2014-02-21syntax: Allow syntax extensions to have attributesErick Tryzelaar-0/+4
2014-02-13Tweak ItemDecorator APISteven Fackler-8/+12
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-08Update deriving to pass around the `cx` linearlyNiko Matsakis-12/+8
2014-02-08Fixed error starting with uppercasemr.Shu-3/+3
Error messages cleaned in librustc/middle Error messages cleaned in libsyntax Error messages cleaned in libsyntax more agressively Error messages cleaned in librustc more aggressively Fixed affected tests Fixed other failing tests Last failing tests fixed
2014-02-08syntax: convert deriving to take &mut ExtCtxt.Huon Wilson-12/+14
2014-01-28syntax: make deriving have slightly less cryptic error messages.Huon Wilson-6/+2
This unfortunately changes an error like error: mismatched types: expected `&&NotClone` but found `&NotClone` into error: type `NotClone` does not implement any method in scope named `clone`
2014-01-09libsyntax: Renamed types, traits and enum variants to CamelCase.Eduard Burtescu-8/+8
2013-12-28Stop using @ExtCtxtSteven Fackler-10/+10
2013-12-07syntax::deriving: add the cx and span to the TraitDef to reduce duplication.Huon Wilson-4/+12
2013-11-19Mark some derived methods as #[inline].Huon Wilson-0/+4
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-10-02syntax: indicate an error when a macro ignores trailing tokens.Huon Wilson-1/+1
That is, only a single expression or item gets parsed, so if there are any extra tokens (e.g. the start of another item/expression) the user should be told, rather than silently dropping them. An example: macro_rules! foo { () => { println("hi"); println("bye); } } would expand to just `println("hi")`, which is almost certainly not what the programmer wanted. Fixes #8012.
2013-09-03Modernized a few more types in syntax::astMarvin Löbel-14/+14
2013-09-01Modernized a few type names in rustc and syntaxMarvin Löbel-14/+14
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-07-20syntax: modernise attribute handling in syntax::attr.Huon Wilson-11/+10
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-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-25great renaming propagation: syntaxCorey Richardson-8/+2
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-11/+4
2013-05-22syntax: Change syntax extensions to expand to `std::foo` instead of `core::foo`Patrick Walton-8/+8
2013-05-22libextra: Rename the actual metadata names of libcore to libstd and libstd ↵Patrick Walton-0/+6
to libextra
2013-05-22syntax/ext: convert all AstBuilder methods to a uniform syntax.Huon Wilson-30/+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-14/+14
2013-05-21syntax/ext: remove the ~str dependence of the deriving code.Huon Wilson-17/+17
2013-05-15auto merge of #6500 : kud1ing/rust/cleanup, r=bstriebors-8/+0
Fixes #6445
2013-05-15remove deriving_eq, deriving_iter_bytes, deriving_clone (deprecated in 0.6)Lenny222-8/+0
2013-05-14rustc: rename ast::self_ty and related fields to explicit_selfErick Tryzelaar-4/+4
2013-05-14syntax: Remove #[allow(vecs_implicitly_copyable)]Alex Crichton-6/+7
2013-05-09Use a specialized string interner to reduce the need for owned stringsBjörn Steinbrink-11/+11
&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: extend generic deriving code to handle almost all possible traits.Huon Wilson-39/+47
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-04-12libsyntax: (maybe) fix deriving(TotalOrd) on windowsHuon Wilson-6/+6
2013-04-12libsyntax: short-circuit on non-matching variants in deriving code.Huon Wilson-41/+29
Allow a deriving instance using the generic code to short-circuit for any non-matching enum variants (grouping them all into a _ match), reducing the number of arms required. Use this to speed up the Eq & TotalEq implementations.
2013-04-12libsyntax: derive Clone, Eq, TotalEq, Ord, TotalOrd with the new generic ↵Huon Wilson-0/+329
deriving code. Closes #4269, #5588 and #5589.