about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving
AgeCommit message (Collapse)AuthorLines
2015-12-15Move built-in syntax extensions to a separate crateSeo Sanghyeon-3876/+0
2015-11-26Some TLC for the MoveMap traitMarvin Löbel-1/+1
2015-11-26Add syntax support for attributes on expressions and all syntaxMarvin Löbel-0/+1
nodes in statement position. Extended #[cfg] folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. Extended lint checker to recognize lint levels on expressions and locals.
2015-11-17Auto merge of #29887 - sanxiyn:match-ref-pats, r=sfacklerbors-2/+2
2015-11-17Fix match_ref_pats flagged by ClippySeo Sanghyeon-2/+2
2015-11-16rename `ast::ImplItem_::*ImplItem` to `ast::ImplItemKind::*`Oliver Schneider-2/+2
2015-11-12libsyntax: deny warnings in doctestsKevin Butler-4/+5
2015-11-09syntax: Use `let _` in #[derive(Debug)]Alex Crichton-4/+21
This should help avoid triggering the unused_results lint which can frequently be turned on. Closes #29710
2015-11-03Don't chain method calls in #[derive(Debug)]Steven Fackler-24/+35
Closes #29540
2015-10-25syntax/rustc_front: Simplify VariantData::fieldsVadim Petrochenkov-4/+4
And use VariantData instead of P<VariantData> in Item_ and Variant_
2015-10-20Auto merge of #29148 - petrochenkov:noshow, r=alexcrichtonbors-5/+3
Closes https://github.com/rust-lang/rust/issues/29145 [breaking-change], needs a crater run.
2015-10-19Generate stability attributes for derived implsVadim Petrochenkov-1/+1
The attributes are copied from the item for which the trait impl is derived
2015-10-18Remove #[derive(Show)]Vadim Petrochenkov-5/+3
2015-10-13Merge struct fields and struct kindVadim Petrochenkov-6/+6
2015-10-13Dict -> Struct, StructDef -> VariantData, def -> dataVadim Petrochenkov-13/+13
2015-10-13Decouple structure kinds from NodeIdsVadim Petrochenkov-1/+1
2015-10-13Unify structures and enum variants in ASTVadim Petrochenkov-81/+29
2015-09-08Allow tracking issues for lang features.Huon Wilson-0/+1
This is similar to the libs version, which allow an `issue` field in the `#[unstable]` attribute. cc #28244
2015-08-29Allow #[derive()] to generate unsafe trait implsMichael Layzell-1/+23
2015-08-28Move ExpnInfo to NameManish Goregaokar-2/+2
2015-08-27Enumify CompilerExpansion in ExpnInfoManish Goregaokar-2/+1
2015-08-24Auto merge of #27239 - apasel422:issue-19102, r=huonwbors-1/+7
closes #19102
2015-08-17Implement `repr(simd)` as an alias for `#[simd]`.Huon Wilson-1/+1
2015-08-03syntax: Implement #![no_core]Alex Crichton-60/+26
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-08-03Auto merge of #27134 - fhartwig:derive, r=huonwbors-0/+11
Fixes #25022 This adapts the deriving mechanism to not repeat bounds for the same type parameter. To give an example: for the following code: ```rust #[derive(Clone)] pub struct FlatMap<I, U: IntoIterator, F> { iter: I, f: F, frontiter: Option<U::IntoIter>, backiter: Option<U::IntoIter>, } ``` the latest nightly generates the following impl signature: ```rust impl <I: ::std::clone::Clone, U: ::std::clone::Clone + IntoIterator, F: ::std::clone::Clone> ::std::clone::Clone for FlatMap<I, U, F> where I: ::std::clone::Clone, F: ::std::clone::Clone, U::IntoIter: ::std::clone::Clone, U::IntoIter: ::std::clone::Clone ``` With these changes, the signature changes to this: ```rust impl <I, U: IntoIterator, F> ::std::clone::Clone for FlatMap<I, U, F> where I: ::std::clone::Clone, F: ::std::clone::Clone, U::IntoIter: ::std::clone::Clone ``` (Nothing in the body of the impl changes) Note that the second impl is more permissive, as it doesn't have a `Clone` bound on `U` at all. There was a compile-fail test that failed due to this. I don't understand why we would want the old behaviour (and nobody on IRC could tell me either), so please tell me if there is a good reason that I missed.
2015-07-28remove `get_ident` and `get_name`, make `as_str` soundOliver Schneider-15/+15
2015-07-23add `#[allow(unused_qualifications)]` to derived implsAndrew Paseltiner-1/+7
closes #19102
2015-07-21Avoid repeated trait bounds in derived implsFlorian Hartwig-0/+11
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