summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2017-05-17Auto merge of #42049 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-84/+90
Rollup of 5 pull requests - Successful merges: #41937, #41957, #42017, #42039, #42046 - Failed merges:
2017-05-16Rollup merge of #41957 - llogiq:clippy-libsyntax, r=petrochenkovMark Simulacrum-84/+90
Fix some clippy warnings in libsyntax This is mostly removing stray ampersands, needless returns and lifetimes. Basically a lot of small changes.
2017-05-16Auto merge of #41907 - est31:macro_unused, r=jseyfriedbors-3/+11
Add lint for unused macros Addresses parts of #34938, to add a lint for unused macros. We now output warnings by default when we encounter a macro that we didn't use for expansion. Issues to be resolved before this PR is ready for merge: - [x] fix the NodeId issue described above - [x] remove all unused macros from rustc and the libraries or set `#[allow(unused_macros)]` next to them if they should be kept for some reason. This is needed for successful boostrap and bors to accept the PR. -> #41934 - [x] ~~implement the full extent of #34938, that means the macro match arm checking as well.~~ *let's not do this for now*
2017-05-16Rollup merge of #42005 - jseyfried:fix_macro_regression, r=nrcMark Simulacrum-5/+6
Fix regression in `macro_rules!` name matching Fixes #41803. r? @nrc
2017-05-15adressed comments by @kennytm and @petrochenkovAndre Bogus-26/+31
2017-05-15Fix regression on `include!(line!())`.Jeffrey Seyfried-5/+5
2017-05-15Fix regression in `macro_rules!` name matching.Jeffrey Seyfried-5/+6
2017-05-15Address review commentsest31-4/+2
2017-05-13Support #[allow] etc logic on a per macro levelest31-3/+7
This commit extends the current unused macro linter to support directives like #[allow(unused_macros)] or #[deny(unused_macros)] directly next to the macro definition, or in one of the modules the macro is inside. Before, we only supported such directives at a per crate level, due to the crate's NodeId being passed to session.add_lint. We also had to implement handling of the macro's NodeId in the lint visitor.
2017-05-13Add lint for unused macrosest31-0/+6
2017-05-13Fix #35829 (syntax extension's `quote_expr!()` does not handle b"…")kennytm-36/+20
* Handles `b"…"`, `br#"…"#` and `...` for `quote_expr!()`. * Refactored the match statement to allow it to complain loudly on any unhandled token. * Similarly, proc_macro's `quote!()` did not handle `br#"…"#` or `r#"…"#`, so this commit fixes it too.
2017-05-12Fix some clippy warnings in libsyntaxAndre Bogus-81/+82
This is mostly removing stray ampersands, needless returns and lifetimes.
2017-05-08Rollup merge of #41520 - estebank:trace-macro, r=nikomatsakisCorey Farwell-5/+19
Use diagnostics for trace_macro instead of println When using `trace_macro`, use `span_label`s instead of `println`: ```rust note: trace_macro --> $DIR/trace-macro.rs:14:5 | 14 | println!("Hello, World!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: expands to `println! { "Hello, World!" }` = note: expands to `print! { concat ! ( "Hello, World!" , "\n" ) }` ``` Fix #22597.
2017-05-07Auto merge of #41676 - sirideain:expand-macro-recursion-limit, r=jseyfriedbors-1/+1
Increase macro recursion limit to 1024 Fixes #22552
2017-05-06Group "macro expansion" notes per call spanEsteban Küber-9/+18
2017-05-05Use diagnostics for trace_macro instead of printlnEsteban Küber-1/+6
2017-05-02Removal pass for anonymous parametersest31-1/+1
Removes occurences of anonymous parameters from the rustc codebase, as they are to be deprecated. See issue #41686 and RFC 1685.
2017-05-01Increase macro recursion limit to 1024 Fixes #22552Charlie Sheridan-1/+1
2017-04-26Implement a file-path remapping feature in support of debuginfo and ↵Michael Woerister-3/+3
reproducible builds.
2017-04-20Don't panic if an attribute macro fails to resolve at crate rootAustin Bonander-2/+12
Adds temporary regression test; this ideally should work as-is (#41430) Closes #41211
2017-04-17Auto merge of #41282 - arielb1:missing-impl-item, r=petrochenkovbors-2/+2
libsyntax/parse: fix missing kind error reporting Fixes #41161. Fixes #41239.
2017-04-17libsyntax/parse: improve associated item error reportingAriel Ben-Yehuda-2/+2
Fixes #41161. Fixes #41239.
2017-04-15feature gate :vis matcherAlex Burka-22/+45
2017-04-15widen :vis follow setAlex Burka-4/+4
2017-04-15parse interpolated visibility tokensAlex Burka-1/+2
2017-04-15update :vis implementation to current rustAlex Burka-6/+6
2017-04-15Implementation of the `vis` macro matcher.Daniel Keep-1/+15
2017-04-12First attempt at global_asm! macroA.J. Gardner-0/+1
2017-04-03Fix bug parsing `#[derive]` macro invocations.Jeffrey Seyfried-1/+2
2017-03-30Improve `Path` spans.Jeffrey Seyfried-16/+31
2017-03-29Refactor how spans are combined in the parser.Jeffrey Seyfried-5/+4
2017-03-29Merge `ExpnId` and `SyntaxContext`.Jeffrey Seyfried-141/+110
2017-03-29Move `syntax::ext::hygiene` to `syntax_pos::hygiene`.Jeffrey Seyfried-132/+5
2017-03-27Rollup merge of #40813 - jseyfried:fix_expansion_regression, r=nrcAlex Crichton-1/+1
macros: fix ICE on some nested macro definitions Fixes #40770. r? @nrc
2017-03-27Fix various useless derefs and slicingsOliver Schneider-1/+1
2017-03-25Fix ICE with nested macros in certain situations.Jeffrey Seyfried-1/+1
2017-03-22Introduce HirId, a replacement for NodeId after lowering to HIR.Michael Woerister-11/+3
HirId has a more stable representation than NodeId, meaning that modifications to one item don't influence (part of) the IDs within other items. The other part is a DefIndex for which there already is a way of stable hashing and persistence. This commit introduces the HirId type and generates a HirId for every NodeId during HIR lowering, but the resulting values are not yet used anywhere, except in consistency checks.
2017-03-21Refactor parsing of trait object typesVadim Petrochenkov-3/+3
2017-03-19Auto merge of #40346 - jseyfried:path_and_tokenstream_attr, r=nrcbors-109/+91
`TokenStream`-based attributes, paths in attribute and derive macro invocations This PR - refactors `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`. - supports macro invocation paths for attribute procedural macros. - e.g. `#[::foo::attr_macro] struct S;`, `#[cfg_attr(all(), foo::attr_macro)] struct S;` - supports macro invocation paths for derive procedural macros. - e.g. `#[derive(foo::Bar, super::Baz)] struct S;` - supports arbitrary tokens as arguments to attribute procedural macros. - e.g. `#[foo::attr_macro arbitrary + tokens] struct S;` - supports using arbitrary tokens in "inert attributes" with derive procedural macros. - e.g. `#[derive(Foo)] struct S(#[inert arbitrary + tokens] i32);` where `#[proc_macro_derive(Foo, attributes(inert))]` r? @nrc
2017-03-14Liberalize attributes.Jeffrey Seyfried-71/+71
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-39/+21
2017-03-14Cleanup.Jeffrey Seyfried-1/+1
2017-03-12Rollup merge of #40369 - petrochenkov:segspan, r=eddybCorey Farwell-7/+12
Give spans to individual path segments in AST And use these spans in path resolution diagnostics. The spans are spans of identifiers in segments, not whole segments. I'm not sure what spans are more useful in general, but identifier spans are a better fit for resolve errors. HIR still doesn't have spans. Fixes https://github.com/rust-lang/rust/pull/38927#discussion_r95336667 https://github.com/rust-lang/rust/pull/38890#issuecomment-271731008 r? @nrc @eddyb
2017-03-11Auto merge of #40220 - jseyfried:ast_macro_def, r=nrcbors-111/+28
syntax: add `ast::ItemKind::MacroDef`, simplify hygiene info This PR - adds a new variant `MacroDef` to `ast::ItemKind` for `macro_rules!` and eventually `macro` items, - [breaking-change] forbids macro defs without a name (`macro_rules! { () => {} }` compiles today), - removes `ast::MacroDef`, and - no longer uses `Mark` and `Invocation` to identify and characterize macro definitions. - We used to apply (at least) two `Mark`s to an expanded identifier's `SyntaxContext` -- the definition mark(s) and the expansion mark(s). We now only apply the latter. r? @nrc
2017-03-10Give spans to individual path segments in ASTVadim Petrochenkov-7/+12
2017-03-10Expect macro defs in save-analysis and add expn info to spans for attr proc ↵Nick Cameron-1/+13
macros
2017-03-10Avoid using `Mark` and `Invocation` for macro defs.Jeffrey Seyfried-16/+5
2017-03-10Move `resolve_invoc` from `syntax` to `resolve`.Jeffrey Seyfried-63/+11
2017-03-10Refactor out `ast::ItemKind::MacroDef`.Jeffrey Seyfried-35/+15
2017-03-03Integrate `TokenStream`.Jeffrey Seyfried-107/+93