diff options
author | Kevin Mehall <[email protected]> | 2021-03-06 16:46:32 +0000 |
---|---|---|
committer | Kevin Mehall <[email protected]> | 2021-03-06 16:48:30 +0000 |
commit | 62f594b390e5f648a32b5b08863a6413b4271d19 (patch) | |
tree | 47de88bc047e957149544f48f2696f2706b9ed4b /crates/proc_macro_srv/src/dylib.rs | |
parent | 632fa8ef4a3c9e7440b79e04a9f7dd9bd23a4de4 (diff) |
Refactor TokenStream to hold Vec<TokenTree> instead of tt::Subtree
`TokenStream` assumes that its subtree's delimeter is `None`, and this
should be encoded in the type system instead of having a delimiter field
that is mostly ignored.
`tt::Subtree` is just `pub delimiter: Option<Delimiter>, pub
token_trees: Vec<TokenTree>`, so a Subtree that is statically guaranteed
not to have a delimiter is just Vec<TokenTree>.
Diffstat (limited to 'crates/proc_macro_srv/src/dylib.rs')
-rw-r--r-- | crates/proc_macro_srv/src/dylib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/proc_macro_srv/src/dylib.rs b/crates/proc_macro_srv/src/dylib.rs index 28a6ee547..baf10fea9 100644 --- a/crates/proc_macro_srv/src/dylib.rs +++ b/crates/proc_macro_srv/src/dylib.rs | |||
@@ -138,7 +138,7 @@ impl Expander { | |||
138 | parsed_body, | 138 | parsed_body, |
139 | false, | 139 | false, |
140 | ); | 140 | ); |
141 | return res.map(|it| it.subtree); | 141 | return res.map(|it| it.into_subtree()); |
142 | } | 142 | } |
143 | bridge::client::ProcMacro::Bang { name, client } if *name == macro_name => { | 143 | bridge::client::ProcMacro::Bang { name, client } if *name == macro_name => { |
144 | let res = client.run( | 144 | let res = client.run( |
@@ -147,7 +147,7 @@ impl Expander { | |||
147 | parsed_body, | 147 | parsed_body, |
148 | false, | 148 | false, |
149 | ); | 149 | ); |
150 | return res.map(|it| it.subtree); | 150 | return res.map(|it| it.into_subtree()); |
151 | } | 151 | } |
152 | bridge::client::ProcMacro::Attr { name, client } if *name == macro_name => { | 152 | bridge::client::ProcMacro::Attr { name, client } if *name == macro_name => { |
153 | let res = client.run( | 153 | let res = client.run( |
@@ -157,7 +157,7 @@ impl Expander { | |||
157 | parsed_body, | 157 | parsed_body, |
158 | false, | 158 | false, |
159 | ); | 159 | ); |
160 | return res.map(|it| it.subtree); | 160 | return res.map(|it| it.into_subtree()); |
161 | } | 161 | } |
162 | _ => continue, | 162 | _ => continue, |
163 | } | 163 | } |