about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2018-08-19fix tidy errorsDonato Sciarra-8/+9
2018-08-19mv codemap source_mapDonato Sciarra-7/+7
2018-08-19mv codemap() source_map()Donato Sciarra-27/+27
2018-08-19mv (mod) codemap source_mapDonato Sciarra-15/+15
2018-08-19mv filemap source_fileDonato Sciarra-37/+37
2018-08-19mv FileMap SourceFileDonato Sciarra-9/+9
2018-08-19mv CodeMap SourceMapDonato Sciarra-27/+27
2018-08-17Rollup merge of #53373 - estebank:unclosed, r=petrochenkovkennytm-11/+21
Tweak unclosed delimiter parser error
2018-08-17Rollup merge of #53360 - PramodBisht:issue/51602, r=estebankkennytm-1/+7
Addressed #51602 Fixed #51602 r? @estebank here I have addressed the case where `in` was not expected right after `if` block. Speaking of `type ascription` I am not sure if this the best approach which I have implemented. Plus I think one more test case can be added to test `type-ascription` case, though I don't have any at this point of time. I will ping you again if all existing testcases pass.
2018-08-16Auto merge of #53293 - petrochenkov:gramattr2, r=alexcrichtonbors-6/+30
syntax: Enforce attribute grammar in the parser Also fix feature-gating for `unrestricted_attribute_tokens` that was introduced in https://github.com/rust-lang/rust/pull/53270, but was actually broken. cc https://github.com/rust-lang/rust/pull/50911
2018-08-16Auto merge of #53289 - ljedrz:improve_lexer, r=michaelwoeristerbors-74/+134
A few cleanups and minor improvements for the lexer - improve readability by adjusting the formatting of some function signatures and adding some newlines - reorder some functions for easier reading - remove redundant `'static` in `const`s - remove some explicit `return`s - read directly to a `String` in `gather_comments_and_literals` - change `unwrap_or!` (macro) to `unwrap_or` (function) - move an `assert!`ion from `try_next_token` (called in a loop) to `try_real_token` after all calls to `try_next_token` - `#[inline]` some one-liner functions - assign directly from an `if-else` expression - refactor a `match` to `map_or` - add a `token::is_irrelevant` function to detect tokens that are not "`real`"
2018-08-15Do not emit "incorrect close delimiter" twice in the same placeEsteban Küber-11/+19
2018-08-15Tweak unclosed delimiter parser errorEsteban Küber-2/+4
2018-08-15syntax: Enforce attribute grammar in the parserVadim Petrochenkov-6/+30
2018-08-14Adddressed #51602Pramod Bisht-1/+7
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-1/+1
2018-08-13A few cleanups and minor improvements for the lexerljedrz-74/+134
2018-08-11Clean up and add extra testsvarkor-12/+3
2018-08-11Add E0642 to parser errorvarkor-3/+6
2018-08-11Emit an error during parsingvarkor-42/+62
2018-08-11Improve diagnosticsvarkor-1/+1
2018-08-11Fix handling of trait methods with bodies and improve efficiencyvarkor-19/+30
2018-08-11Emit error for pattern arguments in trait methodsvarkor-20/+33
The error and check for this already existed, but the parser didn't try to parse trait method arguments as patterns, so the error was never emitted. This surfaces the error, so we get better errors than simple parse errors.
2018-08-05Enable macros to pass $:literal to another macroMatthew Tran-0/+4
2018-08-01async can begin expressionsTaylor Cramer-0/+1
2018-07-29Auto merge of #52738 - ljedrz:push_to_extend, r=eddybbors-3/+1
Replace push loops with extend() where possible Or set the vector capacity where I couldn't do it. According to my [simple benchmark](https://gist.github.com/ljedrz/568e97621b749849684c1da71c27dceb) `extend`ing a vector can be over **10 times** faster than `push`ing to it in a loop: 10 elements (6.1 times faster): ``` test bench_extension ... bench: 75 ns/iter (+/- 23) test bench_push_loop ... bench: 458 ns/iter (+/- 142) ``` 100 elements (11.12 times faster): ``` test bench_extension ... bench: 87 ns/iter (+/- 26) test bench_push_loop ... bench: 968 ns/iter (+/- 3,528) ``` 1000 elements (11.04 times faster): ``` test bench_extension ... bench: 311 ns/iter (+/- 9) test bench_push_loop ... bench: 3,436 ns/iter (+/- 233) ``` Seems like a good idea to use `extend` as much as possible.
2018-07-29Replace push loops with collect() and extend() where possibleljedrz-3/+1
2018-07-29Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkovbors-1/+1
Prefer to_string() to format!() Simple benchmarks suggest in some cases it can be faster by even 37%: ``` test converting_f64_long ... bench: 339 ns/iter (+/- 199) test converting_f64_short ... bench: 136 ns/iter (+/- 34) test converting_i32_long ... bench: 87 ns/iter (+/- 16) test converting_i32_short ... bench: 87 ns/iter (+/- 49) test converting_str ... bench: 54 ns/iter (+/- 15) test formatting_f64_long ... bench: 349 ns/iter (+/- 176) test formatting_f64_short ... bench: 145 ns/iter (+/- 14) test formatting_i32_long ... bench: 98 ns/iter (+/- 14) test formatting_i32_short ... bench: 93 ns/iter (+/- 15) test formatting_str ... bench: 86 ns/iter (+/- 23) ```
2018-07-28Rollup merge of #52740 - estebank:crate-name, r=petrochenkovkennytm-1/+35
Suggest underscore when using dashes in crate namet push fork Fix #48437.
2018-07-27review commentsEsteban Küber-11/+7
2018-07-27Prefer to_string() to format!()ljedrz-1/+1
2018-07-26Suggest underscore when using dashes in crate namet push forkEsteban Küber-3/+41
2018-07-24Rollup merge of #52645 - oli-obk:existential_in_fn_body, r=dtolnayMark Rousskov-0/+6
Allow declaring existential types inside blocks fixes #52631 r? @dtolnay
2018-07-24Auto merge of #51587 - mark-i-m:at_most_once_rep_2018, r=alexcrichtonbors-2/+22
2018 edition `?` Kleene operator This is my first attempt at implementing the migration lint + 2018 behavior as discussed in #48075 r? @nikomatsakis
2018-07-24Allow declaring existential types inside blocksOliver Schneider-0/+6
2018-07-23Allow by default, fix testsmark-0/+1
2018-07-23dump lints _after_ parsing macrosmark-3/+3
2018-07-23Extend ParseSess to support buffering lintsmark-2/+21
2018-07-22rustc: Implement tokenization of nested itemsAlex Crichton-43/+76
Ever plagued by #43081 the compiler can return surprising spans in situations related to procedural macros. This is exhibited by #47983 where whenever a procedural macro is invoked in a nested item context it would fail to have correct span information. While #43230 provided a "hack" to cache the token stream used for each item in the compiler it's not a full-blown solution. This commit continues to extend this "hack" a bit more to work for nested items. Previously in the parser the `parse_item` method would collect the tokens for an item into a cache on the item itself. It turned out, however, that nested items were parsed through the `parse_item_` method, so they didn't receive similar treatment. To remedy this situation the hook for collecting tokens was moved into `parse_item_` instead of `parse_item`. Afterwards the token collection scheme was updated to support nested collection of tokens. This is implemented by tracking `TokenStream` tokens instead of `TokenTree` to allow for collecting items into streams at intermediate layers and having them interleaved in the upper layers. All in all, this... Closes #47983
2018-07-21Auto merge of #52552 - eddyb:proc-macro-prep, r=alexcrichtonbors-6/+0
Prepare proc_macro for decoupling it from the rest of the compiler. This is #49219 up to the point where the bridge is introduced. Aside from moving some code around, the largest change is the rewrite of `proc_macro::quote` to be simpler and do less introspection. I'd like to also extend `quote!` with `${stmt;...;expr}` instead of just `$variable` (and maybe even `$(... $iter ...)*`), which seems pretty straight-forward now, but I don't know if/when I should. r? @alexcrichton or @dtolnay cc @jseyfried @petrochenkov
2018-07-21Auto merge of #52536 - alexcrichton:attr-spans, r=nikomatsakisbors-5/+44
proc_macro: Preserve spans of attributes on functions This commit updates the tokenization of items which are subsequently passed to `proc_macro` to ensure that span information is preserved on attributes as much as possible. Previously this area of the code suffered from #43081 where we haven't actually implemented converting an attribute to to a token tree yet, but a local fix was possible here. Closes #47941
2018-07-20proc_macro: move some implementation details to a rustc module.Eduard-Mihai Burtescu-6/+0
2018-07-19proc_macro: Preserve spans of attributes on functionsAlex Crichton-5/+44
This commit updates the tokenization of items which are subsequently passed to `proc_macro` to ensure that span information is preserved on attributes as much as possible. Previously this area of the code suffered from #43081 where we haven't actually implemented converting an attribute to to a token tree yet, but a local fix was possible here. Closes #47941
2018-07-18Implement existential typesOliver Schneider-17/+56
2018-07-14Address commentsVadim Petrochenkov-1/+1
2018-07-14Remove some tests using AST comparisons, fix other testsVadim Petrochenkov-206/+30
2018-07-14Remove most of `Hash` impls from AST and HIR structuresVadim Petrochenkov-2/+2
2018-07-14Remove most of `PartialEq` impls from AST and HIR structuresVadim Petrochenkov-13/+13
2018-07-10Deny bare trait objects in in src/libsyntaxljedrz-1/+1
2018-07-08Auto merge of #51955 - zackmdavis:item_semi, r=oli-obkbors-0/+16
clarify why we're suggesting removing semicolon after braced items Previously (issue #46186, pull-request #46258), a suggestion was added to remove the semicolon after we fail to parse an item, but issue #51603 complains that it's still insufficiently obvious why. Let's add a note. Resolves #51603.