about summary refs log tree commit diff
path: root/src/libsyntax_ext/deriving/encodable.rs
AgeCommit message (Collapse)AuthorLines
2019-12-30Rename directories for some crates from `syntax_x` to `rustc_x`Vadim Petrochenkov-287/+0
`syntax_expand` -> `rustc_expand` `syntax_pos` -> `rustc_span` `syntax_ext` -> `rustc_builtin_macros`
2019-12-22Format the worldMark Rousskov-74/+98
2019-12-201. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.Mazdak Farrokhzad-1/+1
2. mir::Mutability -> ast::Mutability.
2019-10-16move syntax::ext to new crate syntax_expandMazdak Farrokhzad-1/+1
2019-09-15Give more `Idents` spansMatthew Jasper-9/+9
2019-08-17Remove gensyms from built-in derivesMatthew Jasper-9/+12
Also make them generally more hygienic with name resolution.
2019-08-14Merge Variant and Variant_Caio-1/+1
2019-08-03Rollup merge of #63146 - Mark-Simulacrum:clean-attr, r=petrochenkovMazdak Farrokhzad-1/+0
Cleanup syntax::attr Mostly removing needless arguments to constructors r? @petrochenkov
2019-07-31Remove derives `Encodable`/`Decodable` and unstabilize attribute `#[bench]`Vadim Petrochenkov-17/+1
2019-07-31Replace AstBuilder with inherent methodsMark Rousskov-1/+0
2019-07-07syntax: Migrate built-in macros to the regular stability checkingVadim Petrochenkov-2/+0
2019-02-10rustc: doc commentsAlexander Regueiro-2/+2
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-3/+3
2018-05-21Remove rustc_serialize_exclude_nullManish Goregaokar-12/+2
2018-04-15Provide better names for builtin deriving-generated attributesJames Sanderson-2/+2
2018-04-06Rename `ast::Variant_::name` into `ident` + Fix rebaseVadim Petrochenkov-1/+1
2018-03-22Optimise decode return expression for unit structsvarkor-5/+5
2018-01-29Add internal-only rustc_serialize_exclude_null attribute for making the ↵Manish Goregaokar-2/+14
field only exist in the json if the flag is passed
2017-12-09Use hygiene to access the injected crate (`core` or `std`) from builtin macros.Jeffrey Seyfried-15/+9
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-1/+1
Like #43008 (f668999), but _much more aggressive_.
2017-06-28Auto merge of #42709 - stepancheg:discriminant-hash, r=jseyfriedbors-1/+1
deriv(Hash) for single-variant enum should not hash discriminant Fixes #39137
2017-06-23Removed as many "```ignore" as possible.kennytm-4/+8
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-16deriv(Hash) for single-variant enum should not hash discriminantStepan Koltsov-1/+1
Fixes #39137
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-7/+6
places.
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-2/+2
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-7/+7
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-49/+43
2016-06-26Rollup merge of #34436 - jseyfried:no_block_expr, r=eddybJeffrey Seyfried-1/+1
To allow these braced macro invocation, this PR removes the optional expression from `ast::Block` and instead uses a `StmtKind::Expr` at the end of the statement list. Currently, braced macro invocations in blocks can expand into statements (and items) except when they are last in a block, in which case they can only expand into expressions. For example, ```rust macro_rules! make_stmt { () => { let x = 0; } } fn f() { make_stmt! {} //< This is OK... let x = 0; //< ... unless this line is commented out. } ``` Fixes #34418.
2016-06-23Remove field `expr` of `ast::Block`Jeffrey Seyfried-1/+1
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-26Auto merge of #31414 - durka:clone-copy, r=alexcrichtonbors-1/+1
special-case #[derive(Copy, Clone)] with a shallow clone If a type is Copy then its Clone implementation can be a no-op. Currently `#[derive(Clone)]` generates a deep clone anyway. This can lead to lots of code bloat. This PR detects the case where Copy and Clone are both being derived (the general case of "is this type Copy" can't be determined by a syntax extension) and generates the shallow Clone impl. Right now this can only be done if there are no type parameters (see https://github.com/rust-lang/rust/issues/31085#issuecomment-178988663), but this restriction can be removed after specialization. Fixes #31085.
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-04-12prevent other `encode` methods from breaking `derive(RustcEncodable)`Oliver Schneider-7/+10
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-22Fix #[derive] for empty structs with bracesVadim Petrochenkov-1/+1
2016-02-11[breaking-change] don't glob export ast::Mutablity variantsOliver 'ker' Schneider-2/+2
2016-02-11[breaking-change] don't glob export ast::Expr_ variantsOliver Schneider-9/+7
2015-12-15Move built-in syntax extensions to a separate crateSeo Sanghyeon-0/+289