about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving
AgeCommit message (Collapse)AuthorLines
2015-06-14Replaced a comment mentioning a fixed issueMarkus Westerlind-3/+5
Replaced it with a comment mentioning the rationale for checking the discriminants first.
2015-06-13Utilize discriminant_value for more efficient derivingMarkus-39/+85
The new code generated for deriving on enums looks something like this: ```rust let __self0_vi = unsafe { std::intrinsics::discriminant_value(&self) } as i32; let __self1_vi = unsafe { std::intrinsics::discriminant_value(&__arg1) } as i32; let __self2_vi = unsafe { std::intrinsics::discriminant_value(&__arg2) } as i32; /// if __self0_vi == __self1_vi && __self0_vi == __self2_vi && ... { match (...) { (Variant1, Variant1, ...) => Body1 (Variant2, Variant2, ...) => Body2, ... _ => ::core::intrinsics::unreachable() } } else { ... // catch-all remainder can inspect above variant index values. } ``` This helps massively for C-like enums since they will be compiled as a single comparison giving observed speedups of up to 8x. For more complex enums the speedup is more difficult to measure but it should not be slower to generate code this way regardless.
2015-06-11Conver reborrows to .iter() calls where appropriateJoshua Landau-1/+1
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-6/+6
2015-05-24Auto merge of #25609 - nikomatsakis:const-fn, r=pnkfelixbors-0/+1
This is a port of @eddyb's `const-fn` branch. I rebased it, tweaked a few things, and added tests as well as a feature gate. The set of tests is still pretty rudimentary, I'd appreciate suggestions on new tests to write. Also, a double-check that the feature-gate covers all necessary cases. One question: currently, the feature-gate allows the *use* of const functions from stable code, just not the definition. This seems to fit our usual strategy, and implies that we might (perhaps) allow some constant functions in libstd someday, even before stabilizing const-fn, if we were willing to commit to the existence of const fns but found some details of their impl unsatisfactory. r? @pnkfelix
2015-05-22Let MultiItemDecorator take `&Annotatable` (fixes #25683)Manish Goregaokar-30/+30
2015-05-21syntax: parse `const fn` for free functions and inherent methods.Eduard Burtescu-0/+1
2015-05-17Make #[derive(Debug)] work with unsized fieldsSteven Fackler-5/+11
Closes #25394
2015-05-17Allow #[derive()] to generate unsafe methodsManish Goregaokar-1/+23
2015-05-13Merge branch 'master' into mulit-decorNick Cameron-2/+2
2015-05-12RebasingNick Cameron-17/+17
2015-05-12Merge branch 'master' intoNick Cameron-29/+36
2015-05-11Auto merge of #25085 - carols10cents:remove-old-tilde, r=steveklabnikbors-2/+2
There were still some mentions of `~[T]` and `~T`, mostly in comments and debugging statements. I tried to do my best to preserve meaning, but I might have gotten some wrong-- I'm happy to fix anything :)
2015-05-09Squeeze the last bits of `task`s in documentation in favor of `thread`Barosl Lee-1/+1
An automated script was run against the `.rs` and `.md` files, subsituting every occurrence of `task` with `thread`. In the `.rs` files, only the texts in the comment blocks were affected.
2015-05-03Update old uses of ~ in comments and debugging statementsCarol Nichols-2/+2
2015-05-02Rename AstBuilder::expr_int -> AstBuilder::expr_isizeManish Goregaokar-3/+6
2015-05-01Get tests passingNick Cameron-2/+3
2015-05-01Give access to field attributes in ext::derivingManish Goregaokar-29/+33
2015-04-30WIP refactor expansion of decorators and move derive to MultiDecoratorNick Cameron-129/+139
2015-04-25Rebasing and making MulitDecorators workNick Cameron-12/+3
2015-04-25Merge branch 'syntax' of https://github.com/aochagavia/rust into mulit-decorNick Cameron-5/+15
Conflicts: src/librustc/plugin/registry.rs src/libsyntax/ext/base.rs src/libsyntax/ext/cfg_attr.rs src/libsyntax/ext/deriving/mod.rs src/libsyntax/ext/expand.rs src/libsyntax/print/pprust.rs src/test/auxiliary/macro_crate_test.rs
2015-04-21syntax: Replace [].tail with the stable [1..] syntaxErick Tryzelaar-1/+1
2015-04-21syntax: Remove uses of #[feature(slice_patterns)]Erick Tryzelaar-14/+14
2015-04-21syntax: remove #![feature(box_syntax, box_patterns)]Erick Tryzelaar-16/+16
2015-04-18Auto merge of #23985 - erickt:derive-cleanup, r=ericktbors-512/+496
This extracts some of the minor cleanup patches from #23905.
2015-04-15syntax: Clean up the indentation for #[derive(Eq)]Erick Tryzelaar-12/+14
2015-04-15syntax: Change deriving methods to take a `&mut FnMut(P<Item>)`Erick Tryzelaar-115/+97
This allows #[derive(...)]` to create more than one impl
2015-04-15syntax: Rename deriving/cmp/* to match their current namesErick Tryzelaar-415/+415
2015-04-14Negative case of `len()` -> `is_empty()`Tamir Duberstein-3/+3
`s/([^\(\s]+\.)len\(\) [(?:!=)>] 0/!$1is_empty()/g`
2015-04-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-1/+1
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-14syntax: Remove derive(Rand)Alex Crichton-178/+0
2015-04-10fix some comments.Felix S. Klock II-6/+7
2015-04-10Incorporate repr-attr into deriving(PartialOrd) to avoid truncation errors.Felix S. Klock II-13/+38
remove out of date fixme.
2015-04-10Re-add a fixme after some investigation into what's going on.Felix S. Klock II-0/+11
2015-04-10Change `derive` expansions to use `discriminant_value` intrinsic.Felix S. Klock II-30/+27
Fix #15523.
2015-04-01Fallout in libsyntaxNiko Matsakis-1/+1
2015-03-28Rollup merge of #23803 - richo:unused-braces, r=ManishearthManish Goregaokar-1/+1
Pretty much what it says on the tin.
2015-03-28cleanup: Remove unused braces in use statementsRicho Healey-1/+1
2015-03-27rollup merge of #23741: alexcrichton/remove-int-uintAlex Crichton-1/+1
Conflicts: src/librustc/middle/ty.rs src/librustc_trans/trans/adt.rs src/librustc_typeck/check/mod.rs src/libserialize/json.rs src/test/run-pass/spawn-fn.rs
2015-03-25rustc: Remove support for int/uintAlex Crichton-1/+1
This commit removes all parsing, resolve, and compiler support for the old and long-deprecated int/uint types.
2015-03-24syntax: Update #[derive(...)] to work with phantom and associated typesErick Tryzelaar-6/+118
Closes #7671, #19839
2015-03-23rollup merge of #23506: alexcrichton/remove-some-deprecated-thingsAlex Crichton-10/+0
Conflicts: src/test/run-pass/deprecated-no-split-stack.rs
2015-03-20don't use Result::ok just to be able to use unwrap/unwrap_orOliver Schneider-3/+3
2015-03-18rustc: Remove some long deprecated features:Alex Crichton-10/+0
* no_split_stack was renamed to no_stack_check * deriving was renamed to derive * `use foo::mod` was renamed to `use foo::self`; * legacy lifetime definitions in closures have been replaced with `for` syntax * `fn foo() -> &A + B` has been deprecated for some time (needs parens) * Obsolete `for Sized?` syntax * Obsolete `Sized? Foo` syntax * Obsolete `|T| -> U` syntax
2015-03-12Auto merge of #23265 - eddyb:meth-ast-refactor, r=nikomatsakisbors-24/+18
The end result is that common fields (id, name, attributes, etc.) are stored in now-structures `ImplItem` and `TraitItem`. The signature of a method is no longer duplicated between methods with a body (default/impl) and those without, they now share `MethodSig`. This is also a [breaking-change] because of minor bugfixes and changes to syntax extensions: * `pub fn` methods in a trait no longer parse - remove the `pub`, it has no meaning anymore * `MacResult::make_methods` is now `make_impl_items` and the return type has changed accordingly * `quote_method` is gone, because `P<ast::Method>` doesn't exist and it couldn't represent a full method anyways - could be replaced by `quote_impl_item`/`quote_trait_item` in the future, but I do hope we realize how silly that combinatorial macro expansion is and settle on a single `quote` macro + some type hints - or just no types at all (only token-trees) r? @nikomatsakis This is necessary (hopefully also sufficient) for associated constants.
2015-03-11syntax: move MethMac to MacImplItem and combine {Provided,Required}Method ↵Eduard Burtescu-2/+2
into MethodTraitItem.
2015-03-11syntax: rename TypeMethod to MethodSig and use it in MethDecl.Eduard Burtescu-7/+7
2015-03-11syntax: gather common fields of impl & trait items into their respective types.Eduard Burtescu-26/+20
2015-03-11syntax: move indirection around {Trait,Impl}Item, from within.Eduard Burtescu-7/+7
2015-03-09Switch derive(Debug) to use the debug buildersSteven Fackler-62/+40