summary refs log tree commit diff
path: root/src/libsyntax_ext/deriving/decodable.rs
AgeCommit message (Collapse)AuthorLines
2017-12-09Use hygiene to access the injected crate (`core` or `std`) from builtin macros.Jeffrey Seyfried-14/+6
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-1/+1
Like #43008 (f668999), but _much more aggressive_.
2017-02-05Move derive macro expansion into the MacroExpanderJosh Driver-1/+2
This removes the expand_derives function, and sprinkles the functionality throughout the Invocation Collector, Expander and Resolver.
2017-02-05Make builtin derives a SyntaxExtensionJosh Driver-0/+1
This allows builtin derives to be registered and resolved, just like other derive types.
2016-11-21Use `Symbol` instead of `InternedString` in the AST, HIR, and various other ↵Jeffrey Seyfried-8/+7
places.
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-6/+3
2016-11-10syntax: don't fake a block around closures' bodies during parsing.Eduard Burtescu-3/+3
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-08-18Fix #[derive] for empty tuple structs/variantsVadim Petrochenkov-3/+3
2016-07-19Run rustfmt on libsyntax_ext/deriving folderSrinivas Reddy Thatiparthy-88/+87
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-04-26shallow Clone for #[derive(Copy,Clone)]Alex Burka-1/+1
Changes #[derive(Copy, Clone)] to use a faster impl of Clone when both derives are present, and there are no generics in the type. The faster impl is simply returning *self (which works because the type is also Copy). See the comments in libsyntax_ext/deriving/clone.rs for more details. There are a few types which are Copy but not Clone, in violation of the definition of Copy. These include large arrays and tuples. The very existence of these types is arguably a bug, but in order for this optimization not to change the applicability of #[derive(Copy, Clone)], the faster Clone impl also injects calls to a new function, core::clone::assert_receiver_is_clone, to verify that all members are actually Clone. This is not a breaking change, because pursuant to RFC 1521, any type that implements Copy should not do any observable work in its Clone impl.
2016-03-14derive: improve hygiene for type parameters (see #2810)Alex Burka-5/+7
When deriving Hash, RustcEncodable and RustcDecodable, the syntax extension needs a type parameter to use in the inner method. They used to use __H, __S and __D respectively. If this conflicts with a type parameter already declared for the item, bad times result (see the test). There is no hygiene for type parameters, but this commit introduces a better heuristic by concatenating the names of all extant type parameters (and prepending __H).
2016-02-11[breaking-change] don't glob export ast::Mutablity variantsOliver 'ker' Schneider-2/+2
2015-12-15Move built-in syntax extensions to a separate crateSeo Sanghyeon-0/+224