about summary refs log tree commit diff
path: root/src/libsyntax/ext/expand.rs
AgeCommit message (Collapse)AuthorLines
2018-12-28Auto merge of #57155 - petrochenkov:dcrate3, r=dtolnaybors-0/+4
Resolve `$crate`s for pretty-printing at more appropriate time Doing it in `BuildReducedGraphVisitor` wasn't a good idea, identifiers wasn't actually visited half of the time. As a result some `$crate`s weren't resolved and were therefore pretty-printed as `$crate` literally, which turns into two tokens during re-parsing of the pretty-printed text. Now we are visiting and resolving `$crate` identifiers in an item right before sending that item to a proc macro attribute or derive. Fixes https://github.com/rust-lang/rust/issues/57089
2018-12-28Resolve `$crate`s for pretty-printing at more appropriate timeVadim Petrochenkov-0/+4
2018-12-27Make sure feature gate errors are recoverableVadim Petrochenkov-1/+0
2018-12-27Do not abort compilation if expansion produces errorsVadim Petrochenkov-9/+7
Fix a number of uncovered deficiencies in diagnostics
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-19Remove `eliminate_crate_var` and special pretty-printing for `$crate`Vadim Petrochenkov-4/+1
2018-12-15Rollup merge of #56679 - euclio:external-doc-parse, r=estebankPietro Albini-12/+56
overhaul external doc attribute diagnostics This PR improves the error handling and spans for the external doc attribute. Many cases that silently failed before now emit errors, spans are tightened, and the errors have help and suggestions. I tried to address all the cases that users ran into in the tracking issue. cc #44732 r? @QuietMisdreavus
2018-12-10improve diagnostics for invalid external docsAndy Russell-10/+26
2018-12-10reject invalid external doc attributesAndy Russell-2/+30
Also, provide a suggestion for the correct syntax.
2018-12-10Remove `tokenstream::Delimited`.Nicholas Nethercote-2/+2
Because it's an extra type layer that doesn't really help; in a couple of places it actively gets in the way, and overall removing it makes the code nicer. It does, however, move `tokenstream::TokenTree` further away from the `TokenTree` in `quote.rs`. More importantly, this change reduces the size of `TokenStream` from 48 bytes to 40 bytes on x86-64, which is enough to slightly reduce instruction counts on numerous benchmarks, the best by 1.5%. Note that `open_tt` and `close_tt` have gone from being methods on `Delimited` to associated methods of `TokenTree`.
2018-12-08Auto merge of #56578 - alexreg:cosmetic-1, r=alexregbors-1/+1
Various minor/cosmetic improvements to code r? @Centril 😄
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-12-07use top level `fs` functions where appropriateAndy Russell-23/+24
This commit replaces many usages of `File::open` and reading or writing with `fs::read_to_string`, `fs::read` and `fs::write`. This reduces code complexity, and will improve performance for most reads, since the functions allocate the buffer to be the size of the file. I believe that this commit will not impact behavior in any way, so some matches will check the error kind in case the file was not valid UTF-8. Some of these cases may not actually care about the error.
2018-12-07Unsupport `#[derive(Trait)]` sugar for `#[derive_Trait]` legacy plugin ↵Vadim Petrochenkov-14/+0
attributes
2018-12-04syntax: Rename some keywordsVadim Petrochenkov-1/+1
`CrateRoot` -> `PathRoot`, `::` doesn't necessarily mean crate root now `SelfValue` -> `SelfLower`, `SelfType` -> `SelfUpper`, both `self` and `Self` can be used in type and value namespaces now
2018-11-20Reuse the `P` in `InvocationCollector::fold_{,opt_}expr`.Nicholas Nethercote-36/+48
This requires adding a new method, `P::filter_map`. This commit reduces instruction counts for various benchmarks by up to 0.7%.
2018-11-05Auto merge of #55451 - estebank:arg-doc, r=pnkfelixbors-1/+1
Custom diagnostic when trying to doc comment argument When writing ``` pub fn f( /// Comment id: u8, ) {} ``` Produce a targeted diagnostic ``` error: documentation comments cannot be applied to method arguments --> $DIR/fn-arg-doc-comment.rs:2:5 | LL | /// Comment | ^^^^^^^^^^^ doc comments are not allowed here ``` Fix #54801.
2018-11-03Added support for trait aliases as object types.Alexander Regueiro-1/+1
2018-11-01Rollup merge of #55542 - ljedrz:syntax_alloc_improvements, r=kennytmPietro Albini-0/+2
syntax: improve a few allocations Add 2 `reserve`s and a `with_capacity` where the final vector size is known.
2018-10-31syntax: improve a few allocationsljedrz-0/+2
2018-10-31use String::from() instead of format!() macro to construct Strings.Matthias Krüger-1/+1
2018-10-28Provide specific label for patern parsing errorEsteban Küber-1/+1
2018-10-26Rollup merge of #55298 - estebank:macro-def, r=pnkfelixkennytm-2/+7
Point at macro definition when no rules expect token Fix #35150.
2018-10-24Fix incorrect semicolon suggestionEsteban Küber-1/+3
2018-10-23Point at macro definition when no rules expect tokenEsteban Küber-2/+7
2018-10-23Modify invalid macro in expression context diagnosticEsteban Küber-4/+20
2018-10-05Rollup merge of #54833 - abonander:issue-54441, r=petrochenkovPietro Albini-3/+1
make `Parser::parse_foreign_item()` return a foreign item or error Fixes `Parser::parse_foreign_item()` to follow the convention of `parse_trait_item()` and `parse_impl_item()` in that it *must* parse an item or return an error, and then the caller is responsible for detecting the closing delimiter. This prevents it from looping endlessly on an unexpected token in `ext/expand.rs` where it was also leaking memory by continually pushing to `Parser::expected_tokens` via `Parser::check_keyword()`. closes #54441 r? @petrochenkov cc @dtolnay
2018-10-05Auto merge of #54336 - petrochenkov:preuni, r=alexcrichtonbors-43/+30
resolve: Some refactorings in preparation for uniform paths 2.0 The main result is that in-scope resolution performed during macro expansion / import resolution is now consolidated in a single function (`fn early_resolve_ident_in_lexical_scope`), which can now be used for resolving first import segments as well when uniform paths are enabled. r? @ghost
2018-10-05make `Parser::parse_foreign_item()` return a foreign item or errorAustin Bonander-3/+1
closes #54441
2018-10-05expansion: Remove restriction on use of macro attributes with test/benchVadim Petrochenkov-43/+30
The restrictions were introduced in https://github.com/rust-lang/rust/pull/54277 and no longer necessary now because legacy plugins are now expanded in usual left-to-right order
2018-10-02Merge the `proc_macro_` expansion feature gates into a single ↵jeb-13/+10
`proc_macro_hygiene` gate.
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-18/+23
2018-09-16Temporarily prohibit proc macro attributes placed after derivesVadim Petrochenkov-39/+59
... and also proc macro attributes used together with test/bench.
2018-09-13resolve: Put different parent scopes into a single structureVadim Petrochenkov-1/+1
2018-09-10Track whether module declarations are inline (fixes #12590)Tinco Andringa-0/+1
2018-09-10Feature gate non-builtin attributes in inner attribute positionVadim Petrochenkov-8/+23
2018-09-04Move #[test_case] to a syntax extensionJohn Renner-45/+5
2018-09-04Introduce Custom Test FrameworksJohn Renner-38/+10
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-2/+2
2018-08-23Auto merge of #53384 - gootorov:use-servo-smallvec, r=michaelwoeristerbors-4/+5
Use optimized SmallVec implementation This PR replaces current SmallVec implementation with the one from the Servo project. Closes https://github.com/rust-lang/rust/issues/51640 r? @Mark-Simulacrum
2018-08-23Use optimized SmallVec implementationIgor Gutorov-4/+5
2018-08-23Stabilize a few secondary macro featuresVadim Petrochenkov-10/+5
`tool_attributes`, `proc_macro_path_invoc`, partially `proc_macro_gen`
2018-08-21Auto merge of #53471 - petrochenkov:biattr2, r=oli-obkbors-12/+3
resolve: Some macro resolution refactoring Work towards completing https://github.com/rust-lang/rust/pull/50911#issuecomment-411605393 The last commit also fixes https://github.com/rust-lang/rust/issues/53269 by not using `def_id()` on `Def::Err` and also fixes https://github.com/rust-lang/rust/issues/53512.
2018-08-21Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkorkennytm-1/+1
Fix typos found by codespell.
2018-08-20resolve: Consolidate error reporting for resolved macros in `fn ↵Vadim Petrochenkov-12/+3
resolve_macro_to_def`
2018-08-19mv codemap() source_map()Donato Sciarra-3/+3
2018-08-19mv (mod) codemap source_mapDonato Sciarra-1/+1
2018-08-19mv filemap source_fileDonato Sciarra-1/+1
2018-08-19Fix typos found by codespell.Matthias Krüger-1/+1