summary refs log tree commit diff
path: root/src/libsyntax/ext/tt
AgeCommit message (Collapse)AuthorLines
2017-09-17Rollup merge of #44088 - bjorn3:better_trace_macros, r=jseyfriedTim Neumann-1/+3
Fix "new trace_macros doesn't work if there's an error during expansion" Fixes #43493
2017-09-02Dont abort on first macro errorbjorn3-1/+3
2017-08-30Make fields of `Span` privateVadim Petrochenkov-12/+13
2017-08-21Auto merge of #43540 - petrochenkov:pathrelax, r=nikomatsakisbors-3/+1
syntax: Relax path grammar TLDR: Accept the disambiguator `::` in "type" paths (`Type::<Args>`), accept the disambiguator `::` before parenthesized generic arguments (`Fn::(Args)`). The "turbofish" disambiguator `::<>` in expression paths is a necessary evil required for path parsing to be both simple and to give reasonable results. Since paths in expressions usually refer to values (but not necessarily, e.g. `Struct::<u8> { field: 0 }` is disambiguated, but refers to a type), people often consider `::<>` to be inherent to *values*, and not *expressions* and want to write disambiguated paths for values even in contexts where disambiguation is not strictly necessary, for example when a path is passed to a macro `m!(Vec::<i32>::new)`. The problem is that currently, if the disambiguator is not *required*, then it's *prohibited*. This results in confusion - see https://github.com/rust-lang/rust/issues/41740, https://internals.rust-lang.org/t/macro-path-uses-novel-syntax/5561. This PR makes the disambiguator *optional* instead of prohibited in contexts where it's not strictly required, so people can pass paths to macros in whatever form they consider natural (e.g. disambiguated form for value paths). This PR also accepts the disambiguator in paths with parenthesized arguments (`Fn::(Args)`) for consistency and to simplify testing of stuff like https://github.com/rust-lang/rust/pull/41856#issuecomment-301219194. Closes https://github.com/rust-lang/rust/issues/41740 cc @rust-lang/lang r? @nikomatsakis
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-8/+8
Like #43008 (f668999), but _much more aggressive_.
2017-08-12syntax: #[allow_internal_unsafe] bypasses the unsafe_code lint in macros.Eduard-Mihai Burtescu-3/+9
2017-08-11Issue warnings for unnecessary path disambiguatorsVadim Petrochenkov-3/+1
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-3/+3
2017-07-24Make the macro parser theory description more accuratePiotr Czarnecki-100/+102
2017-07-21Review commentsEsteban Küber-4/+5
2017-07-20Use the macro structure spans instead of the invocationEsteban Küber-2/+15
2017-07-15Auto merge of #43224 - jseyfried:fix_macro_idents_regression, r=nrcbors-1/+2
macros: fix regression involving identifiers in `macro_rules!` patterns. Fixes #42019. r? @nrc
2017-07-13Fix regression involving identifiers in `macro_rules!` patterns.Jeffrey Seyfried-1/+2
2017-07-11let #[allow_internal_unstable] cover :visAlex Burka-8/+19
2017-07-07Only match a fragment specifier the if it starts with certain tokens.kennytm-4/+70
Fixes #24189. Fixes #26444. Fixes #27832. Fixes #34030. Fixes #35650. Fixes #39964. Fixes the 4th comment in #40569. Fixes the issue blocking #40984.
2017-07-06Disallow `$($v:vis)*`. Fix #42755.kennytm-0/+1
2017-07-05Merge remote-tracking branch 'origin/master' into proc_macro_apiAlex Crichton-2/+2
2017-06-29Make `$crate` a keywordVadim Petrochenkov-2/+2
2017-06-26Add `LazyTokenStream`.Jeffrey Seyfried-1/+1
2017-06-26Simplify `hygiene::Mark` application, andJeffrey Seyfried-51/+57
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-06-08Speed up expansion.Mark Simulacrum-27/+34
This reduces duplication, thereby increasing expansion speed.
2017-05-31Extend the unused macro lint to macros 2.0est31-1/+1
2017-05-27Auto merge of #42103 - jorendorff:master, r=estebankbors-3/+12
trace_macro: Show both the macro call and its expansion. #42072. See #42072 for the initial motivation behind this. The change is not the minimal fix, but I want this behavior almost every time I use `trace_macros`.
2017-05-25Hygienize `librustc_resolve`.Jeffrey Seyfried-3/+6
2017-05-25Declarative macros 2.0 without hygiene.Jeffrey Seyfried-7/+8
2017-05-25Refactor out `ast::MacroDef`.Jeffrey Seyfried-1/+1
2017-05-19trace_macro: Show both the macro call and its expansion. #42072.Jason Orendorff-3/+12
2017-05-18Add an option to the parser to avoid parsing out of line modulesNick Cameron-4/+8
This is useful if parsing from stdin or a String and don't want to try and read in a module from another file. Instead we just leave a stub in the AST.
2017-05-17Auto merge of #42049 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-59/+69
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-59/+69
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-1/+3
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-24/+29
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-1/+5
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-12Fix some clippy warnings in libsyntaxAndre Bogus-57/+62
This is mostly removing stray ampersands, needless returns and lifetimes.
2017-05-06Group "macro expansion" notes per call spanEsteban Küber-6/+6
2017-05-05Use diagnostics for trace_macro instead of printlnEsteban Küber-1/+3
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-03-30Improve `Path` spans.Jeffrey Seyfried-15/+11
2017-03-29Refactor how spans are combined in the parser.Jeffrey Seyfried-5/+4
2017-03-29Merge `ExpnId` and `SyntaxContext`.Jeffrey Seyfried-6/+8
2017-03-27Fix various useless derefs and slicingsOliver Schneider-1/+1
2017-03-21Refactor parsing of trait object typesVadim Petrochenkov-1/+1
2017-03-14Liberalize attributes.Jeffrey Seyfried-1/+2