summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2018-11-20squashed form of #54145Nick Cameron-2/+6
Give each PathSegment a NodeId Store a resolved def on hir::PathSegment save-analysis: remove hacky, unnecessary code now that we have spans for every ident dump data for prefix path segments dump refs for path segments in save-analysis Requires adding path segments to the hir map Fix tests and rustdoc save-analysis: handle missing field names FIxes https://github.com/rust-lang-nursery/rls/issues/1031 rebasing and reviewer changes Primarily refactoring `(Ident, Option<NodeId>)` to `Segment` Fix tests and assertions; add some comments more reviewer changes
2018-11-17resolve: Check resolution consistency for import paths and multi-segment ↵Vadim Petrochenkov-0/+7
macro paths
2018-10-29Remove redundant cloneShotaro Yamada-4/+3
2018-10-25Rollup merge of #54977 - estebank:macro-arg-parse, r=pnkfelixPietro Albini-1/+2
Accept `Option<Box<$t:ty>>` in macro argument 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>>; } ``` Fix #25274.
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-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/+2
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-61/+66
2018-09-20Auto merge of #54241 - vi:suggest_with_applicability, r=estebankbors-1/+3
Remove usages of span_suggestion without Applicability Use `Applicability::Unspecified` for all of them instead. Shall deprecations for the non-`_with_applicability` functions be added? Shall clippy be addressed somehow? r? @estebank
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-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-3/+3
2018-09-11resolve: Support resolving identifier macros without their own IDVadim Petrochenkov-5/+4
Invocation/expansion ID (aka `Mark`) is not really necessary for resolving a macro path. What is really necessary is its parent module, parent expansion and parent legacy scope. This is required for validation resolutions of built-in attributes, which don't get their own `Mark`s
2018-09-10Auto merge of #54093 - petrochenkov:noinner, r=alexcrichtonbors-8/+23
Feature gate non-builtin attributes in inner attribute position Closes item 3 from https://github.com/rust-lang/rust/pull/50911#issuecomment-411605393
2018-09-10Track whether module declarations are inline (fixes #12590)Tinco Andringa-0/+2
2018-09-10resolve: Remove `unshadowable_attrs`Vadim Petrochenkov-2/+0
2018-09-10Feature gate non-builtin attributes in inner attribute positionVadim Petrochenkov-8/+23
2018-09-09Auto merge of #53902 - dtolnay:group, r=petrochenkovbors-52/+57
proc_macro::Group::span_open and span_close Before this addition, every delimited group like `(`...`)` `[`...`]` `{`...`}` has only a single Span that covers the full source location from opening delimiter to closing delimiter. This makes it impossible for a procedural macro to trigger an error pointing to just the opening or closing delimiter. The Rust compiler does not seem to have the same limitation: ```rust mod m { type T = } ``` ```console error: expected type, found `}` --> src/main.rs:3:1 | 3 | } | ^ ``` On that same input, a procedural macro would be forced to trigger the error on the last token inside the block, on the entire block, or on the next token after the block, none of which is really what you want for an error like above. This commit adds `group.span_open()` and `group.span_close()` which access the Span associated with just the opening delimiter and just the closing delimiter of the group. Relevant to Syn as we implement real error messages for when parsing fails in a procedural macro: https://github.com/dtolnay/syn/issues/476. ```diff impl Group { fn span(&self) -> Span; + fn span_open(&self) -> Span; + fn span_close(&self) -> Span; } ``` Fixes #48187 r? @alexcrichton
2018-09-08Rename sp_lo to sp_openDavid Tolnay-10/+10
2018-09-08Track distinct spans for open and close delimiterDavid Tolnay-46/+51
2018-09-04Move #[test_case] to a syntax extensionJohn Renner-45/+5
2018-09-04Fix #[test] shadowing in macro_preludeJohn Renner-0/+3
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-24/+24
2018-08-24Rollup merge of #53563 - matthiaskrgr:String, r=varkorkennytm-1/+1
use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into()
2018-08-23Auto merge of #53384 - gootorov:use-servo-smallvec, r=michaelwoeristerbors-21/+22
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 String::new() instead of String::from(""), "".to_string(), "".to_owned() ↵Matthias Krüger-1/+1
or "".into()
2018-08-23Use optimized SmallVec implementationIgor Gutorov-21/+22
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-20/+14
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-4/+4
Fix typos found by codespell.
2018-08-21Rollup merge of #53370 - jkozlowski:stabilize-macro_vis_matcher, r=cramertjkennytm-13/+1
Stabilize macro_vis_matcher This PR should stabilize [macro_vis_matcher](https://github.com/rust-lang/rust/issues/41022) feature. - [ ] "reference" book changes: https://github.com/rust-lang-nursery/reference/pull/400 - [ ] "Rust by example" book changes: https://github.com/rust-lang/rust-by-example/pull/1096 - [ ] "clippy" changes: https://github.com/rust-lang-nursery/rust-clippy/pull/3055 r? @cramertj
2018-08-20resolve: Consolidate error reporting for resolved macros in `fn ↵Vadim Petrochenkov-20/+14
resolve_macro_to_def`
2018-08-19mv codemap() source_map()Donato Sciarra-11/+11
2018-08-19mv (mod) codemap source_mapDonato Sciarra-9/+9
2018-08-19mv filemap source_fileDonato Sciarra-4/+4
2018-08-19mv FileMap SourceFileDonato Sciarra-1/+1
2018-08-19mv CodeMap SourceMapDonato Sciarra-2/+2
2018-08-19Stabilize macro_vis_matcherJakub Kozlowski-13/+1
2018-08-19Fix typos found by codespell.Matthias Krüger-4/+4
2018-08-18Use the new Entry::or_default method where possible.Eduard-Mihai Burtescu-4/+3
2018-08-17Stabilize `use_extern_macros`Vadim Petrochenkov-10/+2
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-84/+88