about summary refs log tree commit diff
path: root/src/libsyntax/test.rs
AgeCommit message (Collapse)AuthorLines
2019-02-13Cleanup importsTaiki Endo-2/+1
2019-02-13Rename rustc_errors dependency in rust 2018 cratesTaiki Endo-1/+1
2019-02-11Use `Rc<[Symbol]>` instead of `Vec<Symbol>` to reduce # of allocsOliver Scherer-2/+2
2019-02-11Require a list of features to allow in `allow_internal_unstable`Oliver Scherer-1/+5
2019-02-07libsyntax => 2018Taiki Endo-25/+27
2019-02-06Overhaul `syntax::fold::Folder`.Nicholas Nethercote-32/+32
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-13Implement basic input validation for built-in attributesVadim Petrochenkov-6/+3
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-10-26Remove redundant cloneShotaro Yamada-1/+1
2018-09-27Auto merge of #52319 - tinco:issue_12590, r=pnkfelixbors-0/+1
Track whether module declarations are inline (fixes #12590) To track whether module declarations are inline I added a field `inline: bool` to `ast::Mod`. The main use case is for pretty to know whether it should render the items associated with the module, but perhaps there are use cases for this information to not be forgotten in the AST.
2018-09-26Remove OneVectorljedrz-5/+4
2018-09-10reintroduce inline to libsyntax testTinco Andringa-54/+1
2018-09-10Track whether module declarations are inline (fixes #12590)Tinco Andringa-0/+54
2018-09-04Move #[test_case] to a syntax extensionJohn Renner-1/+1
2018-09-04Introduce Custom Test FrameworksJohn Renner-476/+104
2018-08-23Use optimized SmallVec implementationIgor Gutorov-2/+3
2018-08-19mv codemap source_mapDonato Sciarra-1/+1
2018-08-19mv (mod) codemap source_mapDonato Sciarra-3/+3
2018-08-19mv FileMap SourceFileDonato Sciarra-1/+1
2018-08-19mv CodeMap SourceMapDonato Sciarra-1/+1
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-7/+8
2018-08-07Avoid unnecessary pattern matching against Option and Resultljedrz-1/+1
2018-07-14Address commentsVadim Petrochenkov-1/+1
2018-07-14Remove most of `PartialEq` impls from AST and HIR structuresVadim Petrochenkov-2/+1
2018-07-10Deny bare trait objects in in src/libsyntaxljedrz-2/+2
2018-06-27Implement `#[macro_export(local_inner_macros)]`Vadim Petrochenkov-0/+1
2018-06-23hygiene: Merge `NameAndSpan` into `ExpnInfo`Vadim Petrochenkov-8/+6
2018-06-21async await desugaring and testsTaylor Cramer-3/+9
2018-06-21Parse async fn header.Without Boats-21/+25
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-20Remove methods from ast::GenericParam and ast::Genericsvarkor-1/+1
2018-06-14create multiple HIR items for a use statementQuietMisdreavus-2/+2
2018-06-06append unused variables with _dylan_DPC-3/+3
2018-06-05remove redundant match branchdylan_DPC-1/+0
2018-06-02Stabilize unit tests with non-`()` return typedylan_DPC-31/+7
2018-05-26Add `Ident::as_str` helperVadim Petrochenkov-1/+1
2018-05-17Add edition to expansion infoVadim Petrochenkov-1/+2
2018-04-26Fixed tidy errors.Irina Popa-1/+3
2018-04-26rustc_target: move in syntax::abi and flip dependency.Irina Popa-1/+1
2018-04-23Don't allow #[should_panic] with non-() testsRussell Cohen-27/+40
2018-04-06Use `Ident` instead of `Name` in `MetaItem`Vadim Petrochenkov-4/+4
2018-04-06Remove more duplicated spansVadim Petrochenkov-1/+1
2018-03-27Auto merge of #49279 - varkor:generated-closure-return-type, r=alexcrichtonbors-1/+1
Fix implicit closure return type generation for libsyntax The `lambda` function for constructing closures in libsyntax was explicitly setting the return type to `_`, which resulted in incorrect corresponding syntax (as `|| -> _ x` is not valid, without the enclosing brackets). This meant the generated code, when printed, was invalid. I also took the opportunity to slightly improve the generated code for the `RustcEncodable::encode` method for unit structs. Fixes #42213.
2018-03-25Rollup merge of #49162 - tmandry:stabilize-termination-trait, r=nikomatsakiskennytm-4/+4
Stabilize termination_trait, split out termination_trait_test For #48453. First time contribution, so I'd really appreciate any feedback on how this PR can be better. Not sure exactly what kind of documentation update is needed. If there is no PR to update the reference, I can try doing that this week as I have time.
2018-03-22Use FunctionRetTy::Default rather than an explicit TyKind::Infer for ↵varkor-1/+1
lambda-building This prevents explicit `-> _` return type annotations for closures generated by `lambda`.
2018-03-22Rollup merge of #49117 - nivkner:fixme_fixup3, r=estebankkennytm-7/+14
address some FIXME whose associated issues were marked as closed part of #44366
2018-03-19Split out termination_trait_test feature gateTyler Mandry-4/+4
2018-03-17AST: Make renames in imports closer to the sourceVadim Petrochenkov-6/+7
Fix `unused_import_braces` lint false positive on `use prefix::{self as rename}`
2018-03-17remove FIXME(#2543) and avoid bad copiesNiv Kaminer-7/+14
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-1/+0