about summary refs log tree commit diff
path: root/src/libproc_macro/quote.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-140/+0
2019-08-27proc_macro: Turn `quote` into a regular built-in macroVadim Petrochenkov-2/+2
Previously in was implemented using a special hack in the metadata loader
2019-02-04libproc_macro => 2018Taiki Endo-18/+18
2018-12-25Remove licensesMark Rousskov-10/+0
2018-10-01The `proc_macro_quote` feature now lives at #54722Alex Crichton-2/+2
2018-07-20proc_macro: clean up the implementation of quasi-quoting.Eduard-Mihai Burtescu-173/+92
2018-07-20proc_macro: don't try to reflect literals in quasi-quoting.Eduard-Mihai Burtescu-94/+15
2018-07-14Clarify how the quote macro is loadedManish Goregaokar-0/+3
2018-06-23hygiene: Do not reset expansion info for `quote!`Vadim Petrochenkov-3/+0
2018-05-25Rename TokenStream::empty to TokenStream::newDavid Tolnay-2/+2
There is no precedent for the `empty` name -- we do not have `Vec::empty` or `HashMap::empty` etc.
2018-05-15Address feedback, remove remaining review comments, add some more docsVadim Petrochenkov-1/+1
2018-05-15proc_macro: Validate inputs to `Punct::new` and `Ident::new`Vadim Petrochenkov-5/+25
2018-05-15TokenTree: Op -> Punct, Term -> IdentVadim Petrochenkov-27/+27
2018-04-30Remove usages of Term::as_str and mark it for removalJohn Kåre Alsaker-1/+1
2018-04-12Change the hashcounts in raw `Lit` variants from usize to u16.Nicholas Nethercote-3/+3
This reduces the size of `Token` from 32 bytes to 24 bytes on 64-bit platforms.
2018-04-06proc_macro: Improve Debug representationsAlex Crichton-9/+6
This commit improves the `fmt::Debug` output of `proc_macro` data structures by primarily focusing on the representation exposed by `proc_macro` rather than the compiler's own internal representation. This cuts down quite a bit on assorted wrapper types and ensure a relatively clean output. Closes #49720
2018-04-02proc_macro: Reorganize public APIAlex Crichton-55/+83
This commit is a reorganization of the `proc_macro` crate's public user-facing API. This is the result of a number of discussions at the recent Rust All-Hands where we're hoping to get the `proc_macro` crate into ship shape for stabilization of a subset of its functionality in the Rust 2018 release. The reorganization here is motivated by experiences from the `proc-macro2`, `quote`, and `syn` crates on crates.io (and other crates which depend on them). The main focus is future flexibility along with making a few more operations consistent and/or fixing bugs. A summary of the changes made from today's `proc_macro` API is: * The `TokenNode` enum has been removed and the public fields of `TokenTree` have also been removed. Instead the `TokenTree` type is now a public enum (what `TokenNode` was) and each variant is an opaque struct which internally contains `Span` information. This makes the various tokens a bit more consistent, require fewer wrappers, and otherwise provides good future-compatibility as opaque structs are easy to modify later on. * `Literal` integer constructors have been expanded to be unambiguous as to what they're doing and also allow for more future flexibility. Previously constructors like `Literal::float` and `Literal::integer` were used to create unsuffixed literals and the concrete methods like `Literal::i32` would create a suffixed token. This wasn't immediately clear to all users (the suffixed/unsuffixed aspect) and having *one* constructor for unsuffixed literals required us to pick a largest type which may not always be true. To fix these issues all constructors are now of the form `Literal::i32_unsuffixed` or `Literal::i32_suffixed` (for all integral types). This should allow future compatibility as well as being immediately clear what's suffixed and what isn't. * Each variant of `TokenTree` internally contains a `Span` which can also be configured via `set_span`. For example `Literal` and `Term` now both internally contain a `Span` rather than having it stored in an auxiliary location. * Constructors of all tokens are called `new` now (aka `Term::intern` is gone) and most do not take spans. Manufactured tokens typically don't have a fresh span to go with them and the span is purely used for error-reporting **except** the span for `Term`, which currently affects hygiene. The default spans for all these constructed tokens is `Span::call_site()` for now. The `Term` type's constructor explicitly requires passing in a `Span` to provide future-proofing against possible hygiene changes. It's intended that a first pass of stabilization will likely only stabilize `Span::call_site()` which is an explicit opt-in for "I would like no hygiene here please". The intention here is to make this explicit in procedural macros to be forwards-compatible with a hygiene-specifying solution. * Some of the conversions for `TokenStream` have been simplified a little. * The `TokenTreeIter` iterator was renamed to `token_stream::IntoIter`. Overall the hope is that this is the "final pass" at the API of `TokenStream` and most of `TokenTree` before stabilization. Explicitly left out here is any changes to `Span`'s API which will likely need to be re-evaluated before stabilization. All changes in this PR have already been reflected to the [`proc-macro2`], `quote`, and `syn` crates. New versions of all these crates have also been published to crates.io. Once this lands in nightly I plan on making an internals post again summarizing the changes made here and also calling on all macro authors to give the APIs a spin and see how they work. Hopefully pending no major issues we can then have an FCP to stabilize later this cycle! [`proc-macro2`]: https://docs.rs/proc-macro2/0.3.1/proc_macro2/
2017-11-14Rename `Span::default` -> `Span::def_site`.Jeffrey Seyfried-1/+1
2017-11-09proc_macro: use the proc_macro API at runtime to construct quasi-quoted ↵Eduard-Mihai Burtescu-129/+117
TokenStream's.
2017-11-09proc_macro: process proc_macro tokens instead of libsyntax ones in the ↵Eduard-Mihai Burtescu-152/+166
quasi-quoter.
2017-09-22Add support for `..=` syntaxAlex Burka-2/+2
Add ..= to the parser Add ..= to libproc_macro Add ..= to ICH Highlight ..= in rustdoc Update impl Debug for RangeInclusive to ..= Replace `...` to `..=` in range docs Make the dotdoteq warning point to the ... Add warning for ... in expressions Updated more tests to the ..= syntax Updated even more tests to the ..= syntax Updated the inclusive_range entry in unstable book
2017-07-07Address review commentspetrochenkov-1/+1
Fix regressions after rebase
2017-06-26Address review comments.Jeffrey Seyfried-6/+10
2017-06-26Implement `quote!` and other `proc_macro` API.Jeffrey Seyfried-0/+259