about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2018-07-07fix perf issue in macro parserMichael Lamparski-1/+8
For a fuller description of the performance issue fixed by this: https://github.com/rust-lang/rust/issues/51754#issuecomment-403242159
2018-06-30Fortify dummy span checkingVadim Petrochenkov-6/+6
2018-06-30hygiene: Implement transparent marksVadim Petrochenkov-1/+12
2018-06-30expansion: Give names to some fields of `SyntaxExtension`Vadim Petrochenkov-20/+26
2018-06-28Auto merge of #50997 - michaelwoerister:pre-analyze-filemaps, r=Mark-Simulacrumbors-5/+9
Make FileMap::{lines, multibyte_chars, non_narrow_chars} non-mutable. This PR removes most of the interior mutability from `FileMap`, which should be beneficial, especially in a multithreaded setting. This is achieved by initializing the state in question when the filemap is constructed instead of during lexing. Hopefully this doesn't degrade performance. cc @wesleywiser
2018-06-27Remove the now redundant CodeMap::new_filemap_with_lines() method.Michael Woerister-5/+9
2018-06-27Implement `#[macro_export(local_inner_macros)]`Vadim Petrochenkov-1/+20
2018-06-23hygiene: Merge `NameAndSpan` into `ExpnInfo`Vadim Petrochenkov-50/+38
2018-06-23hygiene: Do not reset expansion info for `quote!`Vadim Petrochenkov-3/+7
2018-06-23expansion: Add some commentsVadim Petrochenkov-2/+14
2018-06-23expansion: Improve searchability for `AstFragments` methodsVadim Petrochenkov-44/+60
2018-06-23expansion: Rename `Expansion` to `AstFragment`Vadim Petrochenkov-186/+198
2018-06-23expansion: Remove unnecessary override from `impl Folder for Marker`Vadim Petrochenkov-5/+0
2018-06-21async await desugaring and testsTaylor Cramer-0/+2
2018-06-21Parse async fn header.Without Boats-3/+6
This is gated on edition 2018 & the `async_await` feature gate. The parser will accept `async fn` and `async unsafe fn` as fn items. Along the same lines as `const fn`, only `async unsafe fn` is permitted, not `unsafe async fn`.The parser will not accept `async` functions as trait methods. To do a little code clean up, four fields of the function type struct have been merged into the new `FnHeader` struct: constness, asyncness, unsafety, and ABI. Also, a small bug in HIR printing is fixed: it previously printed `const unsafe fn` as `unsafe const fn`, which is grammatically incorrect.
2018-06-20Rename ty_param_bound to trait_boundvarkor-2/+2
2018-06-20Make GenericBound explicitvarkor-1/+2
2018-06-20Rename ParamBound(s) to GenericBound(s)varkor-6/+6
2018-06-20Rename TraitTyParamBound to ParamBound::Traitvarkor-1/+1
2018-06-20Remove name from GenericParamKind::Lifetimevarkor-3/+1
2018-06-20Lift bounds into GenericParamvarkor-8/+8
2018-06-20Rename structures in astvarkor-13/+13
2018-06-20Refactor ast::GenericParam as a structvarkor-10/+17
2018-06-20Rename ast::GenericParam and ast::GenericArgvarkor-5/+5
It's so confusing to have everything having the same name, at least while refactoring.
2018-06-20Make method and variable names more consistentvarkor-6/+6
2018-06-20Rename "parameter" to "arg"varkor-11/+11
2018-06-20Rename *Parameter to *Paramvarkor-5/+5
2018-06-20Consolidate PathParameters and AngleBracketedParameterDatavarkor-19/+14
2018-06-14create multiple HIR items for a use statementQuietMisdreavus-2/+2
2018-06-10Enable fall through past $:lifetime matcherDavid Tolnay-0/+8
2018-06-08Rollup merge of #51417 - pietroalbini:revert-49719, r=nikomatsakiskennytm-22/+67
Revert #49719 This also needs to be backported into beta. Fixes #51416. r? @nikomatsakis
2018-06-07Revert "Auto merge of #49719 - mark-i-m:no_sep, r=petrochenkov"Pietro Albini-22/+67
This reverts commit d6ba1b9b021c408fcad60ee52acf8af5e1b2eb00, reversing changes made to 8de5353f75dcde04abe947e0560dc5edd861cf3a.
2018-06-02Deny #[cfg] and #[cfg_attr] on generic parameters.kennytm-0/+5
2018-05-30resolve: Make sure indeterminate and inconsistent macro resolutions always ↵Vadim Petrochenkov-0/+10
generate errors
2018-05-28Auto merge of #50724 - zackmdavis:applicability_rush, r=Manishearthbors-2/+6
add suggestion applicabilities to librustc and libsyntax A down payment on #50723. Interested in feedback on whether my `MaybeIncorrect` vs. `MachineApplicable` judgement calls are well-calibrated (and that we have a consensus on what this means). r? @Manishearth cc @killercup @estebank
2018-05-27innacurate -> inaccurateTakanori Ishibashi-1/+1
2018-05-26Add `Ident::as_str` helperVadim Petrochenkov-8/+8
2018-05-24Auto merge of #50971 - alexcrichton:no-stringify, r=petrochenkovbors-0/+1
rustc: Correctly pretty-print macro delimiters This commit updates the `Mac_` AST structure to keep track of the delimiters that it originally had for its invocation. This allows us to faithfully pretty-print macro invocations not using parentheses (e.g. `vec![...]`). This in turn helps procedural macros due to #43081. Closes #50840
2018-05-22add `Span` information into `Qself`Niko Matsakis-0/+1
2018-05-22rustc: Correctly pretty-print macro delimitersAlex Crichton-0/+1
This commit updates the `Mac_` AST structure to keep track of the delimiters that it originally had for its invocation. This allows us to faithfully pretty-print macro invocations not using parentheses (e.g. `vec![...]`). This in turn helps procedural macros due to #43081. Closes #50840
2018-05-20suggestion applicabilities for libsyntax and librustc, run-rustfix testsZack M. Davis-2/+6
Consider this a down payment on #50723. To recap, an `Applicability` enum was recently (#50204) added, to convey to Rustfix and other tools whether we think it's OK for them to blindly apply the suggestion, or whether to prompt a human for guidance (because the suggestion might contain placeholders that we can't infer, or because we think it has a sufficiently high probability of being wrong even though it's— presumably—right often enough to be worth emitting in the first place). When a suggestion is marked as `MaybeIncorrect`, we try to use comments to indicate precisely why (although there are a few places where we just say `// speculative` because the present author's subjective judgement balked at the idea that the suggestion has no false positives). The `run-rustfix` directive is opporunistically set on some relevant UI tests (and a couple tests that were in the `test/ui/suggestions` directory, even if the suggestions didn't originate in librustc or libsyntax). This is less trivial than it sounds, because a surprising number of test files aren't equipped to be tested as fixed even when they contain successfully fixable errors, because, e.g., there are more, not-directly-related errors after fixing. Some test files need an attribute or underscore to avoid unused warnings tripping up the "fixed code is still producing diagnostics" check despite the fixes being correct; this is an interesting contrast-to/inconsistency-with the behavior of UI tests (which secretly pass `-A unused`), a behavior which we probably ought to resolve one way or the other (filed issue #50926). A few suggestion labels are reworded (e.g., to avoid phrasing it as a question, which which is discouraged by the style guidelines listed in `.span_suggestion`'s doc-comment).
2018-05-20Auto merge of #50855 - nnethercote:fewer-macro_parser-allocs, r=petrochenkovbors-24/+73
Speed up the macro parser These three commits reduce the number of allocations done by the macro parser, in some cases dramatically. For example, for a clean check builds of html5ever, the number of allocations is reduced by 40%. Here are the rustc-benchmarks that are sped up by at least 1%. ``` html5ever-check avg: -6.6% min: -10.3% max: -4.1% html5ever avg: -5.2% min: -9.5% max: -2.8% html5ever-opt avg: -4.3% min: -9.3% max: -1.6% crates.io-check avg: -1.8% min: -2.9% max: -0.6% crates.io-opt avg: -1.0% min: -2.2% max: -0.1% crates.io avg: -1.1% min: -2.2% max: -0.2% ```
2018-05-20Auto merge of #50820 - alexcrichton:no-modules, r=petrochenkovbors-5/+55
rustc: Disallow modules and macros in expansions This commit feature gates generating modules and macro definitions in procedural macro expansions. Custom derive is exempt from this check as it would be a large retroactive breaking change (#50587). It's hoped that we can hopefully stem the bleeding to figure out a better solution here before opening up the floodgates. The restriction here is specifically targeted at surprising hygiene results [1] that result in non-"copy/paste" behavior. Hygiene and procedural macros is intended to be avoided as much as possible for Macros 1.2 by saying everything is "as if you copy/pasted the code", but modules and macros are sort of weird exceptions to this rule that aren't fully fleshed out. [1]: https://github.com/rust-lang/rust/issues/50504#issuecomment-387734625 cc #50504
2018-05-18rustc: Disallow modules and macros in expansionsAlex Crichton-5/+55
This commit feature gates generating modules and macro definitions in procedural macro expansions. Custom derive is exempt from this check as it would be a large retroactive breaking change (#50587). It's hoped that we can hopefully stem the bleeding to figure out a better solution here before opening up the floodgates. The restriction here is specifically targeted at surprising hygiene results [1] that result in non-"copy/paste" behavior. Hygiene and procedural macros is intended to be avoided as much as possible for Macros 1.2 by saying everything is "as if you copy/pasted the code", but modules and macros are sort of weird exceptions to this rule that aren't fully fleshed out. [1]: https://github.com/rust-lang/rust/issues/50504#issuecomment-387734625 cc #50504
2018-05-18Make `Directory::path` a `Cow`.Nicholas Nethercote-1/+2
Because we create a lot of these in the macro parser, but only very rarely modify them. This speeds up some html5ever runs by 2--3%.
2018-05-18Introduce `MatcherPosHandle`.Nicholas Nethercote-11/+59
This lets us store most `MatcherPos` instances on the stack. This speeds up various runs of html5ever, the best by 3%.
2018-05-17Pass crate editions to macro expansions, update testsVadim Petrochenkov-21/+45
2018-05-17Add edition to expansion infoVadim Petrochenkov-2/+8
2018-05-17Change `TokenTreeOrTokenTreeVec` to `TokenTreeOrTokenTreeSlice`.Nicholas Nethercote-19/+19
This avoids a `to_owned` call that can be hot, speeding up the various runs of html5ever by 1--5%, and some runs of crates.io by 2--3%.
2018-05-16Auto merge of #50045 - est31:label_break_value, r=eddybbors-1/+1
Implement label break value (RFC 2046) Implement label-break-value (#48594).