about summary refs log tree commit diff
path: root/src/libsyntax/ext/derive.rs
AgeCommit message (Collapse)AuthorLines
2019-07-27Move proc macro server into libsyntaxVadim Petrochenkov-72/+0
2019-07-19Adjust other names after the `Mark` renamingVadim Petrochenkov-1/+1
2019-07-11hygiene: Introduce a helper method for creating new expansionsVadim Petrochenkov-5/+2
Creating a fresh expansion and immediately generating a span from it is the most common scenario. Also avoid allocating `allow_internal_unstable` lists for derive markers repeatedly. And rename `ExpnInfo::with_unstable` to `ExpnInfo::allow_unstable`, seems to be a better fitting name.
2019-07-11expand: Do not overwrite existing `ExpnInfo` when injecting derive markersVadim Petrochenkov-3/+4
Create a fresh expansion for them instead - this is the usual way to allow unstable features for generated/desugared code. Fixes https://github.com/rust-lang/rust/issues/52363
2019-07-11hygiene: Reuse `MacroKind` in `ExpnKind`Vadim Petrochenkov-5/+4
Orthogonality and reuse are good.
2019-07-11Rename some things in `syntax_pos/hygiene`Vadim Petrochenkov-2/+2
More consistent with other naming: ExpnFormat -> ExpnKind ExpnKind::name -> ExpnKind::descr DesugaringKind::name -> DesugaringKind::descr Shorter, no tautology: CompilerDesugaring -> Desugaring CompilerDesugaringKind -> DesugaringKind
2019-07-07syntax: Pre-intern names of all built-in macrosVadim Petrochenkov-3/+3
They always end up interned anyway
2019-06-22Lint empty 'derive()' as unused attribute.Mazdak Farrokhzad-4/+0
2019-06-18syntax: Introduce `default`/`with_unstable` constructors for `ExpnInfo`Vadim Petrochenkov-9/+4
2019-06-18syntax: Factor out common fields from `SyntaxExtension` variantsVadim Petrochenkov-1/+1
2019-05-27Auto merge of #61140 - estebank:attr-diagnostics, r=michaelwoeristerbors-2/+8
Reword malformed attribute input diagnostics - Handle empty `cfg_attr` attribute - Reword empty `derive` attribute error - Use consistend error message: "malformed `attrname` attribute input" - Provide suggestions when possible - Move note/help to label/suggestion - Use consistent wording "ill-formed" -> "malformed" - Move diagnostic logic out of parser Split up from https://github.com/rust-lang/rust/pull/61026, where there's prior conversation.
2019-05-27Avoid unnecessary internings.Nicholas Nethercote-5/+2
Most involving `Symbol::intern` on string literals.
2019-05-25Reword malformed attribute input diagnosticsEsteban Küber-2/+8
- Handle empty `cfg_attr` attribute - Reword empty `derive` attribute error - Use consistend error message: "malformed `attrname` attribute input" - Provide suggestions when possible - Move note/help to label/suggestion - Use consistent wording "ill-formed" -> "malformed" - Move diagnostic logic out of parser
2019-05-21Move `edition` outside the hygiene lock and avoid accessing itJohn Kåre Alsaker-2/+2
2019-05-13Remove the equality operation between `Symbol` and strings.Nicholas Nethercote-2/+2
And also the equality between `Path` and strings, because `Path` is made up of `Symbol`s.
2019-02-11Use `Rc<[Symbol]>` instead of `Vec<Symbol>` to reduce # of allocsOliver Scherer-2/+2
2019-02-11Require a list of features to allow in `allow_internal_unstable`Oliver Scherer-1/+4
2019-02-07libsyntax => 2018Taiki Endo-9/+10
2019-02-06Overhaul `syntax::fold::Folder`.Nicholas Nethercote-4/+3
This commit changes `syntax::fold::Folder` from a functional style (where most methods take a `T` and produce a new `T`) to a more imperative style (where most methods take and modify a `&mut T`), and renames it `syntax::mut_visit::MutVisitor`. The first benefit is speed. The functional style does not require any reallocations, due to the use of `P::map` and `MoveMap::move_{,flat_}map`. However, every field in the AST must be overwritten; even those fields that are unchanged are overwritten with the same value. This causes a lot of unnecessary memory writes. The imperative style reduces instruction counts by 1--3% across a wide range of workloads, particularly incremental workloads. The second benefit is conciseness; the imperative style is usually more concise. E.g. compare the old functional style: ``` fn fold_abc(&mut self, abc: ABC) { ABC { a: fold_a(abc.a), b: fold_b(abc.b), c: abc.c, } } ``` with the imperative style: ``` fn visit_abc(&mut self, ABC { a, b, c: _ }: &mut ABC) { visit_a(a); visit_b(b); } ``` (The reductions get larger in more complex examples.) Overall, the patch removes over 200 lines of code -- even though the new code has more comments -- and a lot of the remaining lines have fewer characters. Some notes: - The old style used methods called `fold_*`. The new style mostly uses methods called `visit_*`, but there are a few methods that map a `T` to something other than a `T`, which are called `flat_map_*` (`T` maps to multiple `T`s) or `filter_map_*` (`T` maps to 0 or 1 `T`s). - `move_map.rs`/`MoveMap`/`move_map`/`move_flat_map` are renamed `map_in_place.rs`/`MapInPlace`/`map_in_place`/`flat_map_in_place` to reflect their slightly changed signatures. - Although this commit renames the `fold` module as `mut_visit`, it keeps it in the `fold.rs` file, so as not to confuse git. The next commit will rename the file.
2019-01-13Implement basic input validation for built-in attributesVadim Petrochenkov-0/+5
2018-12-25Remove licensesMark Rousskov-10/+0
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-2/+2
2018-08-19mv (mod) codemap source_mapDonato Sciarra-1/+1
2018-06-27Implement `#[macro_export(local_inner_macros)]`Vadim Petrochenkov-0/+1
2018-06-23hygiene: Merge `NameAndSpan` into `ExpnInfo`Vadim Petrochenkov-8/+6
2018-05-17Add edition to expansion infoVadim Petrochenkov-1/+2
2018-04-06Rename `PathSegment::identifier` to `ident`Vadim Petrochenkov-1/+1
2017-11-26limit packed copy-out to non-generic Copy structsAriel Ben-Yehuda-1/+1
2017-08-30Make fields of `Span` privateVadim Petrochenkov-1/+1
2017-08-12syntax: #[allow_internal_unsafe] bypasses the unsafe_code lint in macros.Eduard-Mihai Burtescu-0/+1
2017-04-03Fix bug parsing `#[derive]` macro invocations.Jeffrey Seyfried-1/+2
2017-03-29Merge `ExpnId` and `SyntaxContext`.Jeffrey Seyfried-24/+26
2017-03-14Liberalize attributes.Jeffrey Seyfried-25/+20
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-2/+2
2017-02-12Allow using inert attributes from `proc_macro_derive`s with ↵Jeffrey Seyfried-135/+35
`#![feature(proc_macro)]`.
2017-02-12Move legacy custom derives collection into `resolver.find_attr_invoc()`.Jeffrey Seyfried-35/+1
2017-02-05Move derive macro expansion into the MacroExpanderJosh Driver-0/+218
This removes the expand_derives function, and sprinkles the functionality throughout the Invocation Collector, Expander and Resolver.