about summary refs log tree commit diff
path: root/src/libsyntax/ext/base.rs
AgeCommit message (Collapse)AuthorLines
2019-02-18Remove `LazyTokenStream`.Nicholas Nethercote-1/+1
It's present within `Token::Interpolated` as an optimization, so that if a nonterminal is converted to a `TokenStream` multiple times, the first-computed value is saved and reused. But in practice it's not needed. `interpolated_to_tokenstream()` is a cold function: it's only called a few dozen times while compiling rustc itself, and a few hundred times across the entire `rustc-perf` suite. Furthermore, when it is called, it is almost always the first conversion, so no benefit is gained from it. So this commit removes `LazyTokenStream`, along with the now-unnecessary `Token::interpolated()`. As well as a significant simplification, the removal speeds things up slightly, mostly due to not having to `drop` the `LazyTokenStream` instances.
2019-02-13Rollup merge of #58273 - taiki-e:rename-dependency, r=matthewjasperMazdak Farrokhzad-1/+1
Rename rustc_errors dependency in rust 2018 crates I think this is a better solution than `use rustc_errors as errors` in `lib.rs` and `use crate::errors` in modules. Related: rust-lang/cargo#5653 cc #58099 r? @Centril
2019-02-12Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnikbors-17/+17
Cosmetic improvements to doc comments This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-13Cleanup importsTaiki Endo-1/+1
2019-02-13Rename rustc_errors dependency in rust 2018 cratesTaiki Endo-1/+1
2019-02-11Parallel rustc needs synchronizing smart pointer cloningOliver Scherer-3/+3
2019-02-11Use `Rc<[Symbol]>` instead of `Vec<Symbol>` to reduce # of allocsOliver Scherer-3/+3
2019-02-11Rename the `exp` field to mirror its usesOliver Scherer-1/+1
2019-02-11Require a list of features to allow in `allow_internal_unstable`Oliver Scherer-7/+13
2019-02-10rustc: doc commentsAlexander Regueiro-17/+17
2019-02-07libsyntax => 2018Taiki Endo-42/+43
2019-02-06Overhaul `syntax::fold::Folder`.Nicholas Nethercote-25/+23
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-26Pretty print `$crate` as `crate` or `crate_name` in more casesVadim Petrochenkov-14/+2
2018-12-30Improve error recovery for some built-in macrosVadim Petrochenkov-4/+5
2018-12-28Auto merge of #57155 - petrochenkov:dcrate3, r=dtolnaybors-0/+14
Resolve `$crate`s for pretty-printing at more appropriate time Doing it in `BuildReducedGraphVisitor` wasn't a good idea, identifiers wasn't actually visited half of the time. As a result some `$crate`s weren't resolved and were therefore pretty-printed as `$crate` literally, which turns into two tokens during re-parsing of the pretty-printed text. Now we are visiting and resolving `$crate` identifiers in an item right before sending that item to a proc macro attribute or derive. Fixes https://github.com/rust-lang/rust/issues/57089
2018-12-28Resolve `$crate`s for pretty-printing at more appropriate timeVadim Petrochenkov-0/+14
2018-12-27Fix `trace_macros` and `log_syntax`Vadim Petrochenkov-12/+18
2018-12-27Do not abort compilation if expansion produces errorsVadim Petrochenkov-5/+4
Fix a number of uncovered deficiencies in diagnostics
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-19Remove `eliminate_crate_var` and special pretty-printing for `$crate`Vadim Petrochenkov-2/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-3/+3
2018-12-07Unsupport `#[derive(Trait)]` sugar for `#[derive_Trait]` legacy plugin ↵Vadim Petrochenkov-7/+0
attributes
2018-11-18resolve: Check resolution consistency for import paths and multi-segment ↵Vadim Petrochenkov-0/+7
macro paths
2018-11-08Use `Lit` rather than `P<Lit>` in `ast::ExprKind`.Nicholas Nethercote-1/+1
Because it results in fewer allocations and small speedups on some benchmarks.
2018-10-23Point at macro definition when no rules expect tokenEsteban Küber-4/+14
2018-09-26Remove OneVectorljedrz-25/+25
2018-09-13resolve: Put different parent scopes into a single structureVadim Petrochenkov-2/+2
2018-09-11resolve: Support resolving identifier macros without their own IDVadim Petrochenkov-5/+4
Invocation/expansion ID (aka `Mark`) is not really necessary for resolving a macro path. What is really necessary is its parent module, parent expansion and parent legacy scope. This is required for validation resolutions of built-in attributes, which don't get their own `Mark`s
2018-09-10resolve: Remove `unshadowable_attrs`Vadim Petrochenkov-2/+0
2018-09-04Fix #[test] shadowing in macro_preludeJohn Renner-0/+3
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-3/+3
2018-08-23Use optimized SmallVec implementationIgor Gutorov-4/+4
2018-08-20resolve: Consolidate error reporting for resolved macros in `fn ↵Vadim Petrochenkov-8/+11
resolve_macro_to_def`
2018-08-19mv codemap() source_map()Donato Sciarra-1/+1
2018-08-19mv (mod) codemap source_mapDonato Sciarra-2/+2
2018-08-19mv CodeMap SourceMapDonato Sciarra-2/+2
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-28/+29
2018-08-06Support custom attributes when macro modularization is enabledVadim Petrochenkov-3/+9
2018-08-06Avoid modifying invocations in place for derive helper attributesVadim Petrochenkov-2/+2
2018-08-01resolve: Implement prelude search for macro pathsVadim Petrochenkov-0/+5
resolve/expansion: Implement tool attributes
2018-07-19Improve suggestion for missing fmt str in printlnEsteban Küber-10/+15
Avoid using `concat!(fmt, "\n")` to improve the diagnostics being emitted when the first `println!()` argument isn't a formatting string literal.
2018-07-15Auto merge of #52383 - petrochenkov:pmns, r=alexcrichtonbors-0/+3
resolve: Functions introducing procedural macros reserve a slot in the macro namespace as well Similarly to https://github.com/rust-lang/rust/pull/52234, this gives us symmetry between internal and external views of a crate, but in this case it's always an error to call a procedural macro in the same crate in which it's defined. Closes https://github.com/rust-lang/rust/issues/52225
2018-07-14Functions introducing procedural macros reserve a slot in the macro ↵Vadim Petrochenkov-0/+3
namespace as well
2018-07-14Remove most of `PartialEq` impls from AST and HIR structuresVadim Petrochenkov-1/+1
2018-07-11Rollup merge of #52224 - ljedrz:dyn_libsyntax, r=oli-obkMark Rousskov-25/+26
Deny bare trait objects in in src/libsyntax Enforce `#![deny(bare_trait_objects)]` in `src/libsyntax`.
2018-07-10Pacify tidyljedrz-1/+2
2018-07-10Deny bare trait objects in in src/libsyntaxljedrz-25/+25
2018-07-08hygiene: Decouple transparencies from expansion IDsVadim Petrochenkov-12/+6
2018-06-30hygiene: Implement transparent marksVadim Petrochenkov-0/+8
2018-06-30expansion: Give names to some fields of `SyntaxExtension`Vadim Petrochenkov-14/+16