about summary refs log tree commit diff
path: root/src/libsyntax/util
AgeCommit message (Collapse)AuthorLines
2019-09-26Rename `Expr.node` to `Expr.kind`varkor-1/+1
For both `ast::Expr` and `hir::Expr`.
2019-09-06reduce visibilityAleksey Kladov-1/+1
2019-08-24Modifies how Arg, Arm, Field, FieldPattern and Variant are visitedCaio-4/+3
Part of the necessary work to accomplish #63468.
2019-08-12Bring back suggestion for splitting `<-` into `< -`Ilija Tovilo-0/+2
Closes #62632
2019-08-02libsyntax: Unconfigure tests during normal buildVadim Petrochenkov-217/+61
2019-07-30Unsupport the await!(..) macro.Mazdak Farrokhzad-1/+1
2019-07-20Introduce rustc_lexerAleksey Kladov-4/+4
The idea here is to make a reusable library out of the existing rust-lexer, by separating out pure lexing and rustc-specific concerns, like spans, error reporting an interning. So, rustc_lexer operates directly on `&str`, produces simple tokens which are a pair of type-tag and a bit of original text, and does not report errors, instead storing them as flags on the token.
2019-07-11Emit dropped unemitted errors to aid in ICE debuggingEsteban Küber-3/+3
2019-07-03Add missing lifetime specifierJeremy Stucki-1/+1
2019-07-03Remove needless lifetimesJeremy Stucki-1/+1
2019-06-23let_chains: Fix bugs in pretty printing.Mazdak Farrokhzad-0/+16
2019-06-23let_chains: Add support for parsing let expressions.Mazdak Farrokhzad-4/+3
2019-06-14Change `...` to `..=` where applicableAaron Kutch-1/+1
2019-06-08syntax: Move most of the `TokenKind` methods to `Token`Vadim Petrochenkov-3/+3
2019-06-06syntax: Rename `Token` into `TokenKind`Vadim Petrochenkov-2/+2
2019-06-06Always use token kinds through `token` module rather than `Token` typeVadim Petrochenkov-25/+25
2019-06-05Implemented for function bounds, type bounds, and named existential types.Alexander Regueiro-2/+2
2019-05-24Remove `ObsoleteInPlace`varkor-10/+4
2019-05-22Simplify use of keyword symbolsVadim Petrochenkov-2/+2
2019-05-21Move `edition` outside the hygiene lock and avoid accessing itJohn Kåre Alsaker-2/+2
2019-05-09Rollup merge of #60188 - estebank:recover-block, r=varkorMazdak Farrokhzad-0/+25
Identify when a stmt could have been parsed as an expr There are some expressions that can be parsed as a statement without a trailing semicolon depending on the context, which can lead to confusing errors due to the same looking code being accepted in some places and not others. Identify these cases and suggest enclosing in parenthesis making the parse non-ambiguous without changing the accepted grammar. Fix #54186, cc #54482, fix #59975, fix #47287.
2019-05-07Implement built-in await syntaxTaylor Cramer-0/+3
Adds support for .await under the existing async_await feature gate. Moves macro-like await! syntax to the await_macro feature gate. Removes support for `await` as a non-keyword under the `async_await` feature.
2019-05-06review comments: fix typo and add commentsEsteban Küber-1/+4
2019-04-29Identify when a stmt could have been parsed as an exprEsteban Küber-0/+22
There are some expressions that can be parsed as a statement without a trailing semicolon depending on the context, which can lead to confusing errors due to the same looking code being accepted in some places and not others. Identify these cases and suggest enclosing in parenthesis making the parse non-ambiguous without changing the accepted grammar.
2019-02-10rustc: doc commentsAlexander Regueiro-5/+5
2019-02-07fix testEsteban Küber-2/+5
2019-02-07libsyntax => 2018Taiki Endo-22/+23
2019-02-06Overhaul `syntax::fold::Folder`.Nicholas Nethercote-21/+8
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-24Remove quote_*! macros and associated APIsMark Simulacrum-1/+1
2018-12-27AST/HIR: Introduce `ExprKind::Err` for better error recovery in the front-endVadim Petrochenkov-1/+3
2018-12-25Remove licensesMark Rousskov-49/+0
2018-12-12Remove `RcVec` and `RcSlice`.Nicholas Nethercote-154/+0
They're both unused now.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-2/+2
2018-12-07Rollup merge of #56516 - frewsxcv:frewsxcv-eq, r=Mark-Simulacrumkennytm-1/+1
Replace usages of `..i + 1` ranges with `..=i`. Before this change we were using old computer code techniques. After this change we use the new and improved computer code techniques.
2018-12-04Replace usages of `..i + 1` ranges with `..=i`.Corey Farwell-1/+1
2018-12-04Fix testShotaro Yamada-1/+2
2018-10-28Provide specific label for patern parsing errorEsteban Küber-1/+1
2018-09-26Remove OneVectorljedrz-2/+2
2018-09-11Add some unit tests for find_best_match_for_namePhilipp Hansch-2/+40
There were only some UI tests that covered this function. Since there's more diagnostic work going on, I think it makes sense to have this unit tested.
2018-08-23Auto merge of #52602 - scottmcm:tryblock-expr, r=nikomatsakisbors-2/+2
Implement try block expressions I noticed that `try` wasn't a keyword yet in Rust 2018, so... ~~Fix​es https://github.com/rust-lang/rust/issues/52604~~ That was fixed by PR https://github.com/rust-lang/rust/pull/53135 cc https://github.com/rust-lang/rust/issues/31436 https://github.com/rust-lang/rust/issues/50412
2018-08-19Rename `Catch` variants to `TryBlock`Scott McMurray-2/+2
(Not `Try` since `QuestionMark` is using that.)
2018-08-19mv codemap() source_map()Donato Sciarra-1/+1
2018-08-19mv (mod) codemap source_mapDonato Sciarra-1/+1
2018-08-19mv filemap source_fileDonato Sciarra-3/+3
2018-08-16Auto merge of #53304 - dtolnay:extend, r=dtolnaybors-0/+90
TokenStream::extend Two new insta-stable impls in libproc_macro: ```rust impl Extend<TokenTree> for TokenStream impl Extend<TokenStream> for TokenStream ``` `proc_macro::TokenStream` already implements `FromIterator<TokenTree>` and `FromIterator<TokenStream>` so I elected to support the same input types for `Extend`. **This commit reduces compile time of Serde derives by 60% (takes less than half as long to compile)** as measured by building our test suite: ```console $ git clone https://github.com/serde-rs/serde $ cd serde/test_suite $ cargo check --tests --features proc-macro2/nightly $ rm -f ../target/debug/deps/libtest_*.rmeta $ time cargo check --tests --features proc-macro2/nightly Before: 20.8 seconds After: 8.6 seconds ``` r? @alexcrichton
2018-08-13Address review of RcVecDavid Tolnay-10/+5
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-143/+2
2018-08-12TokenStream::extendDavid Tolnay-0/+95
2018-07-14Remove some tests using AST comparisons, fix other testsVadim Petrochenkov-8/+0
2018-07-14Remove most of `PartialEq` impls from AST and HIR structuresVadim Petrochenkov-17/+3