Skip to content
Snippets Groups Projects
Commit 6564cc67 authored by Per Lindgren's avatar Per Lindgren
Browse files

readme

parent 0f379d2e
No related branches found
No related tags found
No related merge requests found
......@@ -115,7 +115,7 @@ The error message is presented as a `TokenStream` throught the `.emit()` functio
For the first case (`lit!(99)`) the parsing succeeded and the returned token stream would amount to the literate integer 99. As our `v` is a `LitInt` we need to convert it into a `TokenStream`, a two stage process by first turning `v` into tokens, from wich we get a token stream. (You may comment out the failing parts and print the value of `_v` to convince yourself.)
For the second and third cases, we see that appropriate errors and spans are reported by the built in parser. However the last case is somewhat unsatisfying, due to the `syn::parse` failing (unwrap on an `Err`). We can handle that as well as follows, for the example `ex_lite.rs`.
For the second and third cases, we see that appropriate errors and spans are reported by the built in parser. However the last case is somewhat unsatisfying, due to the `syn::parse` failing (unwrap on an `Err`). We can improve that as follows, `ex_lite.rs`.
``` rust
#![feature(proc_macro)]
......@@ -191,7 +191,7 @@ pub fn lite(input: TokenStream) -> TokenStream {
The description here is the default error, provided by the built in `LitInt` parser.
### Direct approach
## Direct approach
/// MyLit
struct MyLit {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment