about summary refs log tree commit diff
path: root/src/libsyntax/ext/tt
AgeCommit message (Collapse)AuthorLines
2018-10-20handle errors based on parse_sesscsmoe-1/+1
2018-10-12Add missing lifetime fragment specifier to error message.Eric Huss-5/+6
A very minor issue, `lifetime` was missing from the error list. I left `literal` in the list, even though it is unstable. It looks like it may stabilize soon anyways.
2018-10-10Accept `Option<Box<$t:ty>>` in macro argumentEsteban Küber-1/+2
Given the following code, compile successfuly: ``` macro_rules! test { ( fn fun() -> Option<Box<$t:ty>>; ) => { fn fun(x: $t) -> Option<Box<$t>> { Some(Box::new(x)) } } } test! { fn fun() -> Option<Box<i32>>; } ```
2018-09-26Remove OneVectorljedrz-8/+8
2018-09-17Whitespace fix again.Vitaly _Vi Shukela-4/+4
2018-09-17Fill in suggestions Applicability according to @estebankVitaly _Vi Shukela-4/+4
Also fix some formatting along the way.
2018-09-16Remove usages of span_suggestion without ApplicabilityVitaly _Vi Shukela-1/+3
Use Applicability::Unspecified for all of them instead.
2018-09-08Rename sp_lo to sp_openDavid Tolnay-10/+10
2018-09-08Track distinct spans for open and close delimiterDavid Tolnay-37/+38
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-14/+14
2018-08-23Use optimized SmallVec implementationIgor Gutorov-2/+2
2018-08-21Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkorkennytm-3/+3
Fix typos found by codespell.
2018-08-19Stabilize macro_vis_matcherJakub Kozlowski-13/+1
2018-08-19Fix typos found by codespell.Matthias Krüger-3/+3
2018-08-18Use the new Entry::or_default method where possible.Eduard-Mihai Burtescu-2/+1
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-9/+9
2018-08-07Suggest comma when missing in macro callEsteban Küber-2/+2
When missing a comma in a macro call, suggest it, regardless of position. When a macro call doesn't match any of the patterns, check if the call's token stream could be missing a comma between two idents, and if so, create a new token stream containing the comma and try to match against the macro patterns. If successful, emit the suggestion.
2018-08-06Suggest comma when writing `println!("{}" a);`Esteban Küber-1/+26
2018-07-23make it a migration lintmark-3/+32
2018-07-23Fix test and errorsmark-266/+183
2018-07-23Implement 2015 vs 2018 `?` kleene op + testmark-249/+476
2018-07-17Auto merge of #52145 - ExpHP:drop-it-like-its-eof, r=nikomatsakisbors-1/+6
Fix macro parser quadratic complexity in small repeating groups Observed in #51754, and more easily demonstrated with the following: ```rust macro_rules! stress { ($($t:tt)+) => { }; } fn main() { stress!{ a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a // ... 65536 copies of "a" total ... a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a } } ``` which takes 50 seconds to compile prior to the fix and <1s after. I hope this has a visible impact on the compile times for real code. (I think it is most likely to affect incremental TT munchers that deal with large inputs, though it depends on how they are written) For a fuller description of the performance issue: https://github.com/rust-lang/rust/issues/51754#issuecomment-403242159 --- There is no test (yet) because I'm not sure how easily to measure this for regressions.
2018-07-16cleanup unnecessary elseMichael Lamparski-6/+4
2018-07-14Remove most of `Hash` impls from AST and HIR structuresVadim Petrochenkov-3/+3
2018-07-14Remove most of `PartialEq` impls from AST and HIR structuresVadim Petrochenkov-4/+4
2018-07-10Deny bare trait objects in in src/libsyntaxljedrz-2/+2
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-5/+5
2018-06-30hygiene: Implement transparent marksVadim Petrochenkov-0/+3
2018-06-30expansion: Give names to some fields of `SyntaxExtension`Vadim Petrochenkov-1/+5
2018-06-27Implement `#[macro_export(local_inner_macros)]`Vadim Petrochenkov-0/+7
2018-06-23expansion: Rename `Expansion` to `AstFragment`Vadim Petrochenkov-5/+5
2018-06-10Enable fall through past $:lifetime matcherDavid Tolnay-0/+8
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-05-27innacurate -> inaccurateTakanori Ishibashi-1/+1
2018-05-26Add `Ident::as_str` helperVadim Petrochenkov-6/+6
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-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-3/+6
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-13stabilize :lifetimeAlex Burka-13/+1
2018-05-13Macros: Add a 'literal' fragment specifierDan Aloni-2/+21
Implements RFC 1576. See: https://github.com/rust-lang/rfcs/blob/master/text/1576-macros-literal-matcher.md Changes are mostly in libsyntax, docs, and tests. Feature gate is enabled for 1.27.0. Many thanks to Vadim Petrochenkov for following through code reviews and suggestions. Example: ````rust macro_rules! test_literal { ($l:literal) => { println!("literal: {}", $l); }; ($e:expr) => { println!("expr: {}", $e); }; } fn main() { let a = 1; test_literal!(a); test_literal!(2); test_literal!(-3); } ``` Output: ``` expr: 1 literal: 2 literal: -3 ```
2018-05-03check if the token is a lifetime before parsingrleungx-1/+7
2018-04-16Auto merge of #49719 - mark-i-m:no_sep, r=petrochenkovbors-67/+22
Update `?` repetition disambiguation. **Do not merge** (yet) This is a test implementation of some ideas from discussion in https://github.com/rust-lang/rust/issues/48075 . This PR - disallows `?` repetition from taking a separator, since the separator is never used. - disallows the use of `?` as a separator. This allows patterns like `$(a)?+` to match `+` and `a+` rather than `a?a?a`. This is a _breaking change_, but maybe that's ok? Perhaps a crater run is the right approach? cc @durka @alexreg @nikomatsakis
2018-04-06Make lifetime nonterminals closer to identifier nonterminalsVadim Petrochenkov-2/+2
2018-04-06Remove more duplicated spansVadim Petrochenkov-2/+2
2018-04-06Use `Span::apply_mark` where possibleVadim Petrochenkov-3/+3
2018-04-06Get rid of `SpannedIdent`Vadim Petrochenkov-3/+3
2018-04-06Use `Span` instead of `SyntaxContext` in `Ident`Vadim Petrochenkov-8/+5