summary refs log tree commit diff
path: root/src/libsyntax_ext/deriving/generic/mod.rs
AgeCommit message (Collapse)AuthorLines
2018-07-29Replace push loops with collect() and extend() where possibleljedrz-9/+8
2018-07-14Remove most of `PartialEq` impls from AST and HIR structuresVadim Petrochenkov-6/+2
2018-07-12Deny bare trait objects in src/libsyntax_extljedrz-4/+4
2018-06-21Parse async fn header.Without Boats-5/+5
This is gated on edition 2018 & the `async_await` feature gate. The parser will accept `async fn` and `async unsafe fn` as fn items. Along the same lines as `const fn`, only `async unsafe fn` is permitted, not `unsafe async fn`.The parser will not accept `async` functions as trait methods. To do a little code clean up, four fields of the function type struct have been merged into the new `FnHeader` struct: constness, asyncness, unsafety, and ABI. Also, a small bug in HIR printing is fixed: it previously printed `const unsafe fn` as `unsafe const fn`, which is grammatically incorrect.
2018-06-20Fix additional commentsvarkor-1/+1
2018-06-20Rename ty_param_bound to trait_boundvarkor-4/+4
2018-06-20Rename ParamBound(s) to GenericBound(s)varkor-1/+1
2018-06-20Remove name from GenericParamKind::Lifetimevarkor-2/+2
2018-06-20Lift bounds into GenericParamvarkor-8/+7
2018-06-20Simply joint lifetime/type iterationvarkor-27/+10
2018-06-20Rename structures in astvarkor-9/+9
2018-06-20Remove all traces of lifetimes() and types() methodsvarkor-23/+21
2018-06-20Remove methods from ast::GenericParam and ast::Genericsvarkor-1/+4
2018-06-20Refactor ast::GenericParam as a structvarkor-15/+13
2018-06-20Refactor hir::GenericParam as a structvarkor-1/+2
2018-06-20Rename ast::GenericParam and ast::GenericArgvarkor-10/+10
It's so confusing to have everything having the same name, at least while refactoring.
2018-06-20Rename "parameter" to "arg"varkor-3/+3
2018-06-20Rename *Parameter to *Paramvarkor-3/+3
2018-06-20Consolidate PathParameters and AngleBracketedParameterDatavarkor-7/+10
2018-05-02Remove Option from the return type of Attribute::name()Seiichi Uchida-1/+1
2018-04-26rustc_target: move in syntax::abi and flip dependency.Irina Popa-1/+1
2018-04-25Auto merge of #49986 - zofrex:better-derived-argument-names, r=Manishearthbors-12/+12
Provide better names for builtin deriving-generated attributes First attempt at fixing #49967 Not in love with any choices here, don't be shy if you aren't happy with anything :) I've tested that this produces nicer names in documentation, and that it no longer has issues conflicting with constants with the same name. (I guess we _could_ make a test for that... unsure if that would be valuable) In all cases I took the names from the methods as declared in the relevant trait. In some cases I had to prepend the names with _ otherwise there were errors about un-used variables. I'm uneasy with the inconsistency... do they all need to be like that? Is there a way to generate an alternate impl or use a different name (`_`?) in the cases where the arguments are not used? Lastly the gensym addition to Ident I implemented largely as suggested, but I want to point out it's a little circuitous (at least, as far as I understand it). `cx.ident_of(name)` is just `Ident::from_str`, so we create an Ident then another Ident from it. `Ident::with_empty_ctxt(Symbol::gensym(string))` may or may not be equivalent, I don't know if it's important to intern it _then_ gensym it. It seems like either we could use that, or if we do want a new method to make this convenient, it could be on Ident instead (`from_str_gensymed`?)
2018-04-19Fix some of the __names in the commentsJames Sanderson-7/+7
2018-04-19Gensym remaining identifiersJames Sanderson-2/+2
2018-04-15Provide better names for builtin deriving-generated attributesJames Sanderson-3/+3
2018-04-15Auto merge of #49881 - varkor:partialord-opt, r=Manishearthbors-17/+99
Fix derive(PartialOrd) and optimise final field operation ```rust // Before (`lt` on 2-field struct) self.f1 < other.f1 || (!(other.f1 < self.f1) && (self.f2 < other.f2 || (!(other.f2 < self.f2) && (false) )) ) // After self.f1 < other.f1 || (!(other.f1 < self.f1) && self.f2 < other.f2 ) // Before (`le` on 2-field struct) self.f1 < other.f1 || (!(other.f1 < self.f1) && (self.f2 < other.f2 || (!(other.f2 < self.f2) && (true) )) ) // After self.f1 < other.f1 || (self.f1 == other.f1 && self.f2 <= other.f2 ) ``` (The big diff is mainly because of a past faulty rustfmt application that I corrected 😒) Fixes #49650 and fixes #49505.
2018-04-12Improve the comment for cs_fold1varkor-2/+9
2018-04-11Add cs_fold1 for better derivesvarkor-17/+92
2018-04-11Implementation of `#[repr(packed(n))]` RFC 1399.Cameron Hart-3/+7
2018-04-06Rename `ast::Variant_::name` into `ident` + Fix rebaseVadim Petrochenkov-4/+2
2018-04-06Get rid of `SpannedIdent`Vadim Petrochenkov-6/+4
2018-04-06Rename `PathSegment::identifier` to `ident`Vadim Petrochenkov-2/+2
2018-03-22Use FunctionRetTy::Default rather than an explicit TyKind::Infer for ↵varkor-1/+1
lambda-building This prevents explicit `-> _` return type annotations for closures generated by `lambda`.
2018-03-17Rename `Span::empty` to `Span::shrink_to_lo`, add `Span::shrink_to_hi`Vadim Petrochenkov-2/+2
2018-02-18Replace dummy spans with empty spansSeiichi Uchida-2/+2
2018-02-18Change ast::Visibility to Spanned typeSeiichi Uchida-2/+2
2018-01-29rustc: replace "lvalue" terminology with "place" in the code.Eduard-Mihai Burtescu-2/+2
2018-01-16Implement repr(transparent)Robin Kruppe-1/+3
2018-01-07Rename ReprExtern to ReprC, and similarily rename a few other fields and ↵Robin Kruppe-1/+1
locals that mentioned "extern repr"
2018-01-04rustc: use {U,I}size instead of {U,I}s shorthands.Eduard-Mihai Burtescu-2/+2
2017-12-21Add GenericParam, refactor Generics in ast, hir, rustdocJonas Platte-64/+88
The Generics now contain one Vec of an enum for the generic parameters, rather than two separate Vec's for lifetime and type parameters. Additionally, places that previously used Vec<LifetimeDef> now use Vec<GenericParam> instead.
2017-11-26limit packed copy-out to non-generic Copy structsAriel Ben-Yehuda-7/+19
2017-11-26fix #[derive] implementation for repr(packed) structsAriel Ben-Yehuda-16/+64
Fix the derive implementation for repr(packed) structs to move the fields out instead of calling functions on references to each subfield. That's it, `#[derive(PartialEq)]` on a packed struct now does: ```Rust fn eq(&self, other: &Self) { let field_0 = self.0; let other_field_0 = other.0; &field_0 == &other_field_0 } ``` Instead of ```Rust fn eq(&self, other: &Self) { let ref field_0 = self.0; let ref other_field_0 = other.0; &*field_0 == &*other_field_0 } ``` Taking (unaligned) references to each subfield is undefined, unsound and is an error with MIR effectck, so it had to be prevented. This causes a borrowck error when a `repr(packed)` struct has a non-Copy field (and therefore is a [breaking-change]), but I don't see a sound way to avoid that error.
2017-10-17Lifting Generics from MethodSig to TraitItem and ImplItem since we want to ↵Sunjay Varma-1/+2
support generics in each variant of TraitItem and ImplItem
2017-09-21only set non-ADT derive error once per attribute, not per traitZack M. Davis-4/+7
A slight eccentricity of this change is that now non-ADT-derive errors prevent derive-macro-not-found errors from surfacing (see changes to the gating-of-derive compile-fail tests). Resolves #43927.
2017-08-30Make fields of `Span` privateVadim Petrochenkov-6/+6
2017-08-17Rollup merge of #43891 - Fourchaux:master, r=steveklabnikCorey Farwell-1/+1
Fix typos & us spellings Fixing some typos and non en-US spellings. (Update of PR https://github.com/rust-lang/rust/pull/42812 )
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-19/+19
Like #43008 (f668999), but _much more aggressive_.
2017-08-15Fix typos & us spellingsFourchaux-1/+1
2017-07-28syntax: Capture a `TokenStream` when parsing itemsAlex Crichton-0/+2
This is then later used by `proc_macro` to generate a new `proc_macro::TokenTree` which preserves span information. Unfortunately this isn't a bullet-proof approach as it doesn't handle the case when there's still other attributes on the item, especially inner attributes. Despite this the intention here is to solve the primary use case for procedural attributes, attached to functions as outer attributes, likely bare. In this situation we should be able to now yield a lossless stream of tokens to preserve span information.