about summary refs log tree commit diff
path: root/src/libproc_macro/lib.rs
AgeCommit message (Collapse)AuthorLines
2017-07-28syntax: Capture a `TokenStream` when parsing itemsAlex Crichton-6/+57
This is then later used by `proc_macro` to generate a new `proc_macro::TokenTree` which preserves span information. Unfortunately this isn't a bullet-proof approach as it doesn't handle the case when there's still other attributes on the item, especially inner attributes. Despite this the intention here is to solve the primary use case for procedural attributes, attached to functions as outer attributes, likely bare. In this situation we should be able to now yield a lossless stream of tokens to preserve span information.
2017-07-28proc_macro: Use an item's tokens if availableAlex Crichton-8/+20
This partly resolves the `FIXME` located in `src/libproc_macro/lib.rs` when interpreting interpolated tokens. All instances of `ast::Item` which have a list of tokens attached to them now use that list of tokens to losslessly get converted into a `TokenTree` instead of going through stringification and losing span information. cc #43081
2017-07-17Add #[derive(Clone)] to TokenTreeIterChris Wong-0/+1
2017-07-15Auto merge of #43179 - oli-obk:mark_all_the_expansions, r=jseyfriedbors-2/+11
Reintroduce expansion info for proc macros 1.1 r? @jseyfried
2017-07-12Reintroduce expansion info for proc macros 1.1Oliver Schneider-2/+11
2017-07-06Add `isize` and `usize` constructors to LiteralAlex Crichton-1/+1
This commit fills out the remaining integer literal constructors on the `proc_macro::Literal` type with `isize` and `usize`. (I think these were just left out by accident)
2017-06-26Address review comments.Jeffrey Seyfried-77/+113
2017-06-26Add `LazyTokenStream`.Jeffrey Seyfried-8/+28
2017-06-26Implement `quote!` and other `proc_macro` API.Jeffrey Seyfried-24/+450
2017-06-26Clean up `tokenstream::Cursor` and `proc_macro`.Jeffrey Seyfried-17/+11
2017-06-26Simplify `hygiene::Mark` application, andJeffrey Seyfried-12/+16
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-06-15Update older URLs pointing to the first edition of the BookWonwoo Choi-1/+1
`compiler-plugins.html` is moved into the Unstable Book. Explanation is slightly modified to match the change.
2017-03-12Add doc attributes to proc_macro crateOliver Middleton-0/+7
This adds the same logo and favicon as the rest of the std docs.
2017-03-10rustbuild: Build documentation for `proc_macro`Alex Crichton-1/+1
This commit fixes #38749 by building documentation for the `proc_macro` crate by default for configured hosts. Unfortunately did not turn out to be a trivial fix. Currently rustbuild generates documentation into multiple locations: one for std, one for test, and one for rustc. The initial fix for this issue simply actually executed `cargo doc -p proc_macro` which was otherwise completely elided before. Unfortunately rustbuild was the left to merge two documentation trees together. One for the standard library and one for the rustc tree (which only had docs for the `proc_macro` crate). Rustdoc itself knows how to merge documentation files (specifically around search indexes, etc) but rustbuild was unaware of this, so an initial fix ended up destroying the sidebar and the search bar from the libstd docs. To solve this issue the method of documentation has been tweaked slightly in rustbuild. The build system will not use symlinks (or directory junctions on Windows) to generate all documentation into the same location initially. This'll rely on rustdoc's logic to weave together all the output and ensure that it ends up all consistent. Closes #38749
2017-03-03Integrate `TokenStream`.Jeffrey Seyfried-4/+3
2017-03-02Rollup merge of #40129 - abonander:proc_macro_bang, r=jseyfriedCorey Farwell-0/+4
Implement function-like procedural macros ( `#[proc_macro]`) Adds the `#[proc_macro]` attribute, which expects bare functions of the kind `fn(TokenStream) -> TokenStream`, which can be invoked like `my_macro!()`. cc rust-lang/rfcs#1913, #38356 r? @jseyfried cc @nrc
2017-02-28Implement function-like procedural macros ( `#[proc_macro]`)Austin Bonander-0/+4
2017-02-28Add `syntax::ext::tt::quoted::{TokenTree, ..}` and remove ↵Jeffrey Seyfried-2/+1
`tokenstream::TokenTree::Sequence`.
2017-01-22Refactor `TokenStream`.Jeffrey Seyfried-5/+6
2017-01-15Refactor `proc_macro::TokenStream` to use ↵Austin Bonander-26/+47
`syntax::tokenstream::TokenStream`; fix tests for changed semantics
2017-01-08Auto merge of #38679 - alexcrichton:always-deny-warnings, r=nrcbors-1/+1
Remove not(stage0) from deny(warnings) Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2017-01-04Document custom derive.Steve Klabnik-4/+2
These are some bare-bones documentation for custom derive, needed to stabilize "macros 1.1", https://github.com/rust-lang/rust/issues/35900 The book chapter is based off of a blog post by @cbreeden, https://cbreeden.github.io/Macros11/ Normally, we have a policy of not mentioning external crates in documentation. However, given that syn/quote are basically neccesary for properly using macros 1.1, I feel that not including them here would make the documentation very bad. So the rules should be bent in this instance.
2017-01-02rustc: Stabilize the `proc_macro` featureAlex Crichton-3/+6
This commit stabilizes the `proc_macro` and `proc_macro_lib` features in the compiler to stabilize the "Macros 1.1" feature of the language. Many more details can be found on the tracking issue, #35900. Closes #35900
2016-12-29Remove not(stage0) from deny(warnings)Alex Crichton-1/+1
Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2016-11-08Allow proc_macro functions to whitelist specific attributesJosh Driver-1/+2
By using a second attribute `attributes(Bar)` on proc_macro_derive, whitelist any attributes with the name `Bar` in the deriving item. This allows a proc_macro function to use custom attribtues without a custom attribute error or unused attribute lint.
2016-10-29Move `CrateConfig` from `Crate` to `ParseSess`.Jeffrey Seyfried-3/+1
2016-10-06rustc: Rename rustc_macro to proc_macroAlex Crichton-110/+140
This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`, which reflects the general consensus of #35900. A follow up PR to Cargo will be required to purge the `rustc-macro` name as well.
2016-08-16Proc_macro is alivecgswords-0/+137