about summary refs log tree commit diff
path: root/src/libsyntax_ext/deriving/cmp/partial_eq.rs
AgeCommit message (Collapse)AuthorLines
2019-12-30Rename directories for some crates from `syntax_x` to `rustc_x`Vadim Petrochenkov-112/+0
`syntax_expand` -> `rustc_expand` `syntax_pos` -> `rustc_span` `syntax_ext` -> `rustc_builtin_macros`
2019-12-22Format the worldMark Rousskov-24/+29
2019-11-05Remove `PartialEq` and `Eq` from the `SpecialDerives`.Felix S. Klock II-3/+0
2019-10-27rustc, rustc_passes: don't depend on syntax_expand.Mazdak Farrokhzad-2/+3
This is done by moving some data definitions to syntax::expand.
2019-10-25Migrate from `#[structural_match]` attribute a lang-item trait.Felix S. Klock II-1/+6
(Or more precisely, a pair of such traits: one for `derive(PartialEq)` and one for `derive(Eq)`.) ((The addition of the second marker trait, `StructuralEq`, is largely a hack to work-around `fn (&T)` not implementing `PartialEq` and `Eq`; see also issue rust-lang/rust#46989; otherwise I would just check if `Eq` is implemented.)) Note: this does not use trait fulfillment error-reporting machinery; it just uses the trait system to determine if the ADT was tagged or not. (Nonetheless, I have kept an `on_unimplemented` message on the new trait for structural_match check, even though it is currently not used.) Note also: this does *not* resolve the ICE from rust-lang/rust#65466, as noted in a comment added in this commit. Further work is necessary to resolve that and other problems with the structural match checking, especially to do so without breaking stable code (adapted from test fn-ptr-is-structurally-matchable.rs): ```rust fn r_sm_to(_: &SM) {} fn main() { const CFN6: Wrap<fn(&SM)> = Wrap(r_sm_to); let input: Wrap<fn(&SM)> = Wrap(r_sm_to); match Wrap(input) { Wrap(CFN6) => {} Wrap(_) => {} }; } ``` where we would hit a problem with the strategy of unconditionally checking for `PartialEq` because the type `for <'a> fn(&'a SM)` does not currently even *implement* `PartialEq`. ---- added review feedback: * use an or-pattern * eschew `return` when tail position will do. * don't need fresh_expansion; just add `structural_match` to appropriate `allow_internal_unstable` attributes. also fixed example in doc comment so that it actually compiles.
2019-10-16move syntax::ext to new crate syntax_expandMazdak Farrokhzad-1/+1
2019-08-15hygiene: `ExpnInfo` -> `ExpnData`Vadim Petrochenkov-1/+1
For naming consistency with everything else in this area
2019-08-15hygiene: Merge `ExpnInfo` and `InternalExpnData`Vadim Petrochenkov-1/+1
2019-08-03Move special treatment of `derive(Copy, PartialEq, Eq)` from expansion ↵Vadim Petrochenkov-1/+3
infrastructure to elsewhere
2019-07-31Replace AstBuilder with inherent methodsMark Rousskov-1/+0
2019-07-31Remove Span argument from ExtCtxt::attributeMark Rousskov-1/+1
MetaItem.span was always equivalent
2019-06-08use pattern matching for slices destructuringCedric-2/+2
2019-05-27Avoid unnecessary internings.Nicholas Nethercote-2/+2
Most involving `Symbol::intern` on string literals.
2019-02-04libsyntax_ext => 2018Taiki Endo-9/+9
2018-12-25Remove licensesMark Rousskov-10/+0
2018-07-12Deny bare trait objects in src/libsyntax_extljedrz-1/+1
2018-04-25Auto merge of #49986 - zofrex:better-derived-argument-names, r=Manishearthbors-1/+1
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-19Don't prepend deriving-generated attributes with _James Sanderson-1/+1
2018-04-15Provide better names for builtin deriving-generated attributesJames Sanderson-1/+1
2018-04-12Abstract cs_eq for partial_eqvarkor-50/+27
2018-04-11Remove redundant operation in derive[PartialEq]varkor-28/+58
2017-12-09Use hygiene to access the injected crate (`core` or `std`) from builtin macros.Jeffrey Seyfried-1/+2
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-2/+2
Like #43008 (f668999), but _much more aggressive_.
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-2/+2
2016-11-20Refactor `MetaItemKind` to use `Name`s instead of `InternedString`s.Jeffrey Seyfried-2/+2
2016-10-31Changed most vec! invocations to use square bracesiirelu-2/+2
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-08-30Future proof `libsyntax_ext` for `union`.Jeffrey Seyfried-0/+1
2016-07-19Run rustfmt on libsyntax_ext/deriving folderSrinivas Reddy Thatiparthy-30/+31
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-1/+1
2016-05-12Improve derived implementations for enums with lots of fieldless variantsBjörn Steinbrink-0/+1
A number of trait methods like PartialEq::eq or Hash::hash don't actually need a distinct arm for each variant, because the code within the arm only depends on the number and types of the fields in the variants. We can easily exploit this fact to create less and better code for enums with multiple variants that have no fields at all, the extreme case being C-like enums. For nickel.rs and its by now infamous 800 variant enum, this reduces optimized compile times by 25% and non-optimized compile times by 40%. Also peak memory usage is down by almost 40% (310MB down to 190MB). To be fair, most other crates don't benefit nearly as much, because they don't have as huge enums. The crates in the Rust distribution that I measured saw basically no change in compile times (I only tried optimized builds) and only 1-2% reduction in peak memory usage.
2016-03-01derive: Emit only PartialOrd::partial_cmp for simple enumsUlrik Sverdrup-17/+1
Using the same logic as for `PartialEq`, when possible define only `partial_cmp` and leave `lt, le, gt, ge` to their default implementations. This works well for c-like enums.
2016-02-29derive: Skip PartialEq::ne for any zero-field enum or structUlrik Sverdrup-17/+15
Also detect unit structs and enums with zero field struct variants.
2016-02-29derive: Avoid emitting PartialEq::ne for c-like enumsUlrik Sverdrup-5/+28
`ne` is completely symmetrical with the method `eq`, and we can save rust code size and compilation time here if we only emit one of them when possible. One case where it's easy to recognize is when it's a C-like enum. Most other cases can not omit ne, because any value field may have a custom PartialEq implementation.
2016-02-11[breaking-change] don't glob export ast::BinOp_Oliver Schneider-5/+5
2015-12-15Move built-in syntax extensions to a separate crateSeo Sanghyeon-0/+97