commit | e6085b71802f21a9c5429af0a8b56e916c20c48a | [log] [tgz] |
---|---|---|
author | Alex Crichton <alex@alexcrichton.com> | Tue Nov 21 07:24:25 2017 -0800 |
committer | Alex Crichton <alex@alexcrichton.com> | Tue Nov 21 07:24:25 2017 -0800 |
tree | 18b00236330227ccb65f7e090488d474600eb64f | |
parent | 5d6580725f5011c9f567268cb377338e79e44eb4 [diff] |
Add `Span::def_site`-the-API
A small shim over the proc_macro
crate in the compiler intended to multiplex the current stable interface (as of 2017-07-05) and the upcoming richer interface.
The upcoming support has features like:
The hope is that libraries ported to proc_macro2
will be trivial to port to the real proc_macro
crate once the support on nightly is stabilize.
This crate by default compiles on the stable version of the compiler. It only uses the stable surface area of the proc_macro
crate upstream in the compiler itself. Usage is done via:
[dependencies] proc-macro2 = "0.1"
followed by
extern crate proc_macro; extern crate proc_macro2; #[proc_macro_derive(MyDerive)] pub fn my_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream { let input: proc_macro2::TokenStream = input.into(); let output: proc_macro2::TokenStream = { /* transform input */ }; output.into() }
If you'd like you can enable the unstable
feature in this crate. This will cause it to compile against the unstable and nightly-only features of the proc_macro
crate. This in turn requires a nightly compiler. This should help preserve span information, however, coming in from the compiler itself.
You can enable this feature via:
[dependencies] proc-macro2 = { version = "0.1", features = ["unstable"] }
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Serde by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.