Generalize macros 1.1 example
diff --git a/README.md b/README.md
index 76f54fc..d550609 100644
--- a/README.md
+++ b/README.md
@@ -36,13 +36,14 @@
```
## Usage with [Macros 1.1](https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md)
+
```rust
// lib.rs
#![crate_type = "rustc-macro"]
-#![feature(rustc_macro)]
-#![feature(rustc_macro_lib)]
+#![feature(rustc_macro, rustc_macro_lib)]
extern crate rustc_macro;
+
#[macro_use]
extern crate quote;
extern crate syn;
@@ -56,10 +57,16 @@
// Parse a string of items to an AST
let ast = syn::parse_item(&source).unwrap();
+ // Build the output, possibly using quasi-quotation
+ let expanded = quote! {
+ // ...
+ };
+
// Parse this back to a token stream and return it
- quote!(#ast).to_string().parse().unwrap()
+ expanded.to_string().parse().unwrap()
}
```
+
```toml
# Cargo.toml
# ...